5th Sem Octave - DSP Manual
5th Sem Octave - DSP Manual
LABORATORY MANUAL
2022-2023
Semester :V
VISION
The East Point College of Engineering and Technology aspires to be a globally acclaimed
institution, recognized for excellence in engineering education, applied research and
nurturing students for holistic development.
MISSION
M1: To create engineering graduates through quality education and to nurture innovation,
creativity and excellence in teaching, learning and research
M2: To serve the technical, scientific, economic and societal developmental needs of our
communities
M3: To induce integrity, teamwork, critical thinking, personality development and ethics in
students and to lay the foundation for lifelong learning
Department of Electronics and communication Engineering
DEPARTMENT VISION AND MISSION
VISION
The Department aspires to be a centre of excellence in Electronics and Communication
Engineering to develop competitive and ethical professionals through holistic development.
MISSION
M1: To impart quality education and provide a conducive environment for innovation and
Research
M2: To develop skills to meet the scientific, technological and socio-economic needs
M3: To inculcate professional ethics, team work, leadership qualities and lifelong learning
PSO1: To conceptualise, model, design, simulate, analyse, develop, test electronic and
communication systems and solve technical problems arising in the field of Electronics and
Communication Engineering.
PSO3: To demonstrate building and testing of electronics and communication systems and
evaluate their performance and efficiency using appropriate tools and techniques.
COURSE LEARNING OBJECTIVES
COURSE OUTCOMES
Credits – 2
Course Learning Objectives :
This course will enable students to
Simulate discrete time signals and verification of sampling theorem.
Compute the DFT for a discrete signal and verification of its properties using
OCTAVE.
Find solution to the difference equations and computation of convolution and
correlation along with the verification of properties.
Compute and display the filtering operations and compare with the theoretical
values.
Implement the DSP computations on DSP hardware and verify the result.
Syllabus:
PART A
1 Verification of sampling theorem (use interpolation function).
2 Linear and circular convolution of two given sequences, Commutative, distributive
and associative property of convolution.
3 Auto and cross correlation of two sequences and verification of their properties
4 Solving a given difference equation.
5 Computation of N-point DFT of a given sequence and to plot magnitude and phase
spectrum (using DFT equation and verify it by built-in routine).
6 (i) Verification of DFT properties (like Linearity and Parseval’s theorem, etc.)
(ii) DFT computation of square pulse and Sinc function etc.
7 Design and implementation of Low pass and High pass FIR filter to meet the desired
specifications (using different window techniques) and test the filter with an audio
file. Plot the spectrum of audio signal before and after filtering.
8 Design and implementation of a digital HR filter (Low pass and High pass) to meet
given specifications and test with an audio file. Plot the spectrum of audio signal
before and after filtering.
PART B
9 Obtain the Linear convolution of two sequences.
12 Determine the Impulse response of first order and second order system
Course Outcomes:
At the end of this course, students should be able to:
OCTAVE PROGRAMS
clc;
clear all;
close all;
f= 1/T;
x=2*sin(2*pi*t/T);
subplot(2,2,1);
plot(t,x);
title('Continuous signal');
xlabel('t');
ylabel('x(t)');
ts1=0.002; %> NR
ts2=0.01; %=NR
ts3=0.1;%< NR
n=0:10;
xts1=2*sin(2*pi*n*ts1/T);
subplot(2,2,2);
stem(n,xts1);
title('Greater than NR');
xlabel('n');
ylabel('x(n)');
n=0:10;
xts2=2*sin(2*pi*n*ts2/T);
subplot(2,2,3);
stem(n,xts2);
title('Equal to R');
xlabel('n');
ylabel('x(n)');
Output plot:
2A. Linear convolution of two given sequences, Commutative, distributive and associative property of
convolution.
clc;
clear all;
close all;
x=input('enter the first sequence')
y=input('enter the second sequence')
c=conv(x,y)
subplot(3,1,1)
t=0:length(x)-1;
stem(t,x)
xlabel('n')
ylabel('x(n)')
grid on
subplot(3,1,2)
t=0:length(y)-1
stem(t,y)
xlabel('n')
ylabel('y(n)')
grid on
subplot(3,1,3)
t=0:length(c)-1
stem(t,c)
xlabel('n')
ylabel('c(n)')
grid on
Output:
x=
1 1 1 1 1
y=
1 2 3 4
c=
1 3 6 10 10 9 7 4
I) Commutative Property
clc;
clear all;
close all;
x=input('enter the first sequence=');
h=input('enter the second sequence=');
y1=conv(x,h);
disp('convolution of two sequences x(n) and h(n) is y1(n)=');
disp(y1);
y2=conv(h,x);
disp('convolution of two sequences h(n) and x(n) is y2(n)=');
disp(y2);
if (y1==y2)
disp('commutative property holds good under convolution');
else
disp('commutative property does not hold good under convolution');
end
clc;
clear all;
close all;
x=input('enter the first sequence=');
h1=input('enter the second sequence=');
h2=input('enter the third sequence=');
y1=conv(x,h1);
y2=conv(y1,h2);
clc;
clear all;
close all;
x=input('enter the first sequence=');
n=input (‘enter the time index sequence:’);
h1=input('enter the second sequence=');
h2=input('enter the third sequence=');
h3=h1+h2;
y1=conv(x,h3);
if (y1==y4)
disp('Distributive property holds good under convolution');
else
disp('Distributive property does not hold good under convolution');
end
Output:
% output
1 1 2 2 1 1 0
-5 -4 -3 -2 -1 0 1
1 1 2 2 1 1 0
1 1 2 2 1 1 0
2 1 4 2 2 1 0
2 1 4 2 2 1 0
% Figure Window
I) Commutative Property
clc;
clear all;
close all;
clc;
clear all;
close all;
clc;
clear all;
close all;
if (y1==y4)
disp('Distributive property holds good under convolution');
else
disp('Distributive property does not hold good under convolution');
end
Output:
% output
1 1 2 2 1 1 0
-5 -4 -3 -2 -1 0 1
1 1 2 2 1 1 0
1 1 2 2 1 1 0
Commutative prop proved
2 1 4 2 2 1 0
2 1 4 2 2 1 0
% Figure Window
2B. Circular convolution of two given sequences, Commutative, distributive and associative property of
convolution.
disp('circular convolution');
disp(Y);
n=0:N-1;
figure;
subplot(3,1,1);
stem(n,X1);
xlabel('time');
ylabel('amplitude');
title('1st seq');
subplot(3,1,2);
stem(n,X2);
xlabel('time');
ylabel('amplitude');
title('2nd seq');
subplot(3,1,3);
stem(n,Y);
xlabel('time');
ylabel('amplitude');
title('circular convolution');
disp(n);
% Commutative property
Y1=cconv(X1,X2,N);
Y2=cconv(X2,X1,N);
disp(Y1);
disp(Y2); if(Y1==Y2)
disp('commmutative prop proved');
else
disp('commmutative prop not proved');
end;
%Associative property
% Distributive property
Y5=cconv(X1,(X2+X3),N6);
disp(Y5);
X5=cconv(X1,X3,N6);
Y6=Y1+X5;
disp(Y6); if(Y5==Y6)
disp('distributive prop proved');
else
disp('distributive prop not proved'); end;
Output:
% input
Circular convolution
2 2 2 2
% output
0 1 2 3
2 2 2 2
2 2 2 2
4 4 4 4
4 4 4 4
2 4 2 4
2 4 2 4
Output Plot:
%properties
energy=((sum(x.^2)+sum(y.^2))./2)
co=ceil(length(z)./2);
zo=z(co)
if zo==energy
disp('zo gives energy proved') else
disp('zo gives energy not proved')
end
zright=z(co:1:length(z))
zleft=z(co:-1:1)
if zright==zleft
disp('z is even')
else
disp('z is odd')
end
subplot(2,2,1)
t=0:length(x)-1
stem(t,x)
xlabel('n')
ylabel('x(n)')
title('first input')
grid on;
subplot(2,2,2)
t=0:length(y)-1
stem(t,y)
xlabel('n')
ylabel('y(n)')
title('second input')
grid on;
Output:
enter the first sequence[1 2 3 1]
x=12 31
z=
t=0 1 2 3 4 5 6
energy = 24
zo = 18
subplot(2,2,3)
t=0:length(z)-1
stem(t,z)
xlabel('n')
ylabel('amplitude')
title('cross correlation') grid on;
%properties
energy=sum(x.^2)
co=ceil(length(z)./2);
zo=z(co)
if (zo = = energy)
disp('zo gives energy proved')
else
disp('zo gives energy not proved')
end
zright=z(co:1:length(z))
zleft=z(co:-1:1)
if zright==zleft
disp('z is even')
else
disp('z is odd')
end
subplot(2,2,1)
t=0:length(x)-1
stem(t,x)
xlabel('n')
ylabel('x(n)')
title('first input')
grid on;
Output:
z=
4.0000 11.0000 20.0000 30.0000 20.0000 11.0000 4.0000
t=
01 2 3 4 5 6
energy = 30
zo = 30
zo gives energy proved
zright =
zleft =
Output1:
Output2:
a=
1.0000 -0.7500 0.1250
5. Computation of N point DFT of a given sequence and to plot magnitude and phase spectrum (using
DFT equation and verify it by built-in routine).
clc;
clear all;
close all;
disp(X)
magnitude=abs(X)
phase=angle(X)
subplot(2,1,1)
t=0:length(X)-1
stem(t,magnitude)
xlabel('period')
ylabel('magnitude of X(K)')
grid on
subplot(2,1,2)
t=0:length(X)-1
stem(t,phase)
xlabel('period')
ylabel('phase of X(k)')
grid on
clc;
clear all;
close all;
magxk=abs(X(k));
disp(„Magnitude of X(k)‟);
disp(mag X(k));
phasexk=angle(X(k));
disp(„Phase angle of X(k)‟);
disp(phase X(k));
%Plotting results
k=0:N-1;
subplot(2,1,1);
stem(k,mag X(k));
title(„Magnitude of DFT');
xlabel('frequency');
ylabel('magnitude');
subplot(2,1,2);
stem(k,phase X(k));
title('Phase of DFT');
xlabel('frequency');
ylabel('phase in radians');
Output:
Magnitude of X(k)
0 2.0000 0.0000 2.0000
Output Plot:
6A. Verification of DFT properties (like Linearity and Parseval’s theorem, etc.)
clc;
clear all;
close all;
x3=a*x1+b*x2;
y1=fft(x3); disp('LHS=');
disp(y1);
X1=fft(x1);
X2=fft(x2);
Y2=a*X1+b*X2; disp('RHS=');disp(Y2);
if(y1==Y2)
Output:
%% Input/output
LHS=
RHS=
% Parsevals theorem
clc;
close all;
clear all;
y1=conj(y);
N=length(x);
El=0;
for n=1:N El=El+x(n)*y1(n);
end;
disp('The energy El='); disp(El);
X=fft(x);
Y=fft(y);
Y1=conj(Y);
Er=0;
for k=1:N Er=Er+X(k)*Y1(k)/N;
end;
disp('The energy Er='); disp(Er);
if (El==Er);
disp('Parsevals is proved');
else
disp('Parsevals is not proved');
end;
Output:
%% Input/output
Parsevals is proved
clc;
close all;
clear all;
X1=fft(x1);
X2=fft(x2);
Mr=(cconv(X1,X2,N))/N;
Output:
%%Input / Output
%% Circular convolution
clc;
clear all;
close all;
cl=cconv(x1,x2,N);
disp('circular convolution in time domain=');
disp(cl);
X1=fft(x1);
X2=fft(x2);
X3=X1.*X2;
cr=(ifft(X3));
disp('circular convolution in time domain is equal to multiplication in freq domain');
disp(cr);
if(cl==cr)
disp('circular convilution is proved');
else
disp('circular convolution not proved');
end;
Output:
0 -1 0 1
Circular convolution in time domain is equal to multiplication in freq domain
0 -1 0 1
clear all;
close all;
t=-pi:0.05:pi;
x=sinc(t);
X=fft(x);
X1=fftshift(X);
subplot(2,1,1);
stem(x);
title('time domain');
subplot(2,1,2);
plot(abs(X1));
title('freq domain');
Output Plot:
clc;
clear all;
close all;
x=[zeros(1,32),ones(1,64),zeros(1,32)];
X=fft(x);
X1=fftshift(X);
subplot(2,1,1);
plot(x);
title('time domain');
subplot(2,1,2);
plot(abs(X1));
title('freq domain');
Output Plot:
7. Design and implementation of FIR filter to meet given specifications (using different window
techniques).
clc;
clear all;
close all;
w1=input('Enter the pass band edge frequency in rads,w1=');
w2=input('Enter the stop band edge frequency in rads,w2=');
k1=input('Enter the pass band attenuation in dB,k1=');
k2=input('Enter the stop band attenuation in dB,k2=');
wt=(w2-w1);
n=ceil((8*pi)/wt);
if rem(n,2)==0
n=n+1;
end;
disp('The order of the filter is =');
disp(n);
w=hamming(n);
figure(1);
stem(w);
title('Plot of window function');
xlabel('n----------->');
ylabel('w(n)--------->');
disp('The hamming window coefficients are');
disp(w);
hn=fir1(n,wt);
figure(2);
freqz(hn,1,512); grid on;
xlabel('Normalized frequency');
ylabel('Gain in dBs');
title('Frequency response of the FIR Filter');
disp('The unit sample response of FIR filter is h(n)');
disp(hn);
Example: To design a low pass FIR filter using hamming window for the following specifications.
Result:
Output Plot:
8A. Design and implementation of IIR (Butterworth) filter to meet given specifications.
clc;
clear all;
close all;
f1=input('Enter the Passband frequency in Hz,f1=');
f2=input('Enter the Stopband frequency in Hz,f2=');
k1=input('Enter the Passband attenuation in dB,k1=');
k2=input('Enter the Stopband attenuation in dB,k2=');
fs=input('Enter the Sampling frequency in Hz,fs=');
T=1/fs;
w1=(2*pi*f1*T);
w2=(2*pi*f2*T);
wp=(2)*tan((w1)/2);
ws=(2)*tan((w2)/2);
[n,wn]=buttord(wp,ws,k1,k2,'s');
disp('The order of the filter is=');
disp(n);
semilogx((w*fs)/(2*pi),20*log10(abs(h)));
axis([0 10000 -10 0])
xlabel('w in rads----------------->');
ylabel('20*abs(Hejw)------------------>');
title('Frequency response of the filter');
disp('The Numerator coefficients of H(s) are=');
disp(nu);
Example:
Result:
Output Plot:
8B. Design and implementation of IIR (Chebyshev) filter to meet given specifications.
clc;
clear all;
close all;
f1=input('Enter the Passband frequency in Hz,f1=');
f2=input('Enter the Stopband frequency in Hz,f2=');
k1=input('Enter the Passband attenuation in dB,k1=');
k2=input('Enter the Stopband attenuation in dB,k2=');
fs=input('Enter the Sampling frequency in Hz,fs=');
T=1/fs;
w1=(2*pi*f1*T);
w2=(2*pi*f2*T);
wp=(2)*tan((w1)/2);
disp(wp);
ws=(2)*tan((w2)/2);
disp(ws);
[n,wn]=cheb1ord(wp,ws,k1,k2,'s');
disp('The order of the filter is=');
disp(n);
disp('Cut off frequency is =');
disp(wn); [nu,de]=cheby1(n,k1,wn,'s');
[b,a]=bilinear(nu,de,1);
[h,w]=freqz(b,a);
semilogx((w*fs)/(2*pi),20*log10(abs(h)));
axis([0 10000 -10 0])
xlabel('w in rads----------------->');
ylabel('20*abs(Hejw)------------------>');
title('Frequency response of the filter');
disp('The Numerator coefficients of H(s) are=');
disp(nu);
disp('The Denominator coefficients of H(s) are=');
disp(de);
disp('The Numerator coefficients of H(Z) are=');
disp(b);
disp('The Denominator coefficients of H(Z) are='); disp(a);
Example:
Result:
Enter the Passband frequency in Hz,f1=100
Enter the Stopband frequency in Hz,f2=500
Enter the Passband attenuation in dB,k1=2
Enter the Stopband attenuation in dB,k2=20
Enter the Sampling frequency in Hz,fs=4000
0.1574
0.8284
The order of the filter is= 2
Cut off frequency is = 0.1574
The Numerator coefficients of H(s) are = 0 0 0.0162
The Denominator coefficients of H(s) are = 1.0000 0.1265 0.0204
The Numerator coefficients of H(Z) are = 0.0038 0.0076 0.0038
The Denominator coefficients of H(Z) are = 1.0000 -1.8625 0.8816
Output Plot:
INTERFACING PROGRAMS
Target → TMS320C67XX
Step3:
Step4:
→ C:\CCstudio_v3.1\tutorial\dsk6713\hello1\hello
Step5:
Step6:
Click on the file name so that it gets added to the project Step7:
Go to Project → Compile
Step 8:
Step 9:
Step10:
Debug→Run
Step11:
View→Graph→Time/Frequency
The Code Composer Studio (CCS) provides an integrated development environment (IDE) to incorporate the
software tools. CCS includes tools for code generation, such as a C compiler, an assembler, and a linker. It has
graphical capabilities and supports real-time debugging. It provides an easy-to-use software tool to build and
debug programs. The C compiler compiles a C source program with extension .c to produce an assembly
source file with extension .asm. The assembler assembles an.asm source file to produce a machine language
object file with extension .obj. The linker combines object files and object libraries as input to produce an
executable file with extension out. This executable file represents a linked common object file format (COFF),
popular in Unix-based systems and adopted by several makers of digital signal processors. This executable file
can be loaded and run directly on the C6713 processor. To create an application project, one can “add” the
appropriate files to the project.
Compiler/linker options can readily be specified. A number of debugging features are available, including
setting breakpoints and watching variables, viewing memory, registers, and mixed C and assembly code,
graphing results, and monitoring execution time. One can step through a program in different ways (step into,
or over, or out). Real-time analysis can be performed using real-time data exchange (RTDX) associated with
DSP/BIOS .RTDX allows for data exchange between the host and the target and analysis in real time without
stopping the target. Key statistics and performance can be monitored in real time. Through the Joint Team
Action Group (JTAG), communication with on-chip emulation support occurs to control and monitor program
execution. The C6713 DSK board includes a JTAG emulator interface.
Example:
To find the impulse response of a first order system.
Result:
The response of the system is
1.0000
0.5000
#include <stdio.h>
float y[3]={0,0,0};
float x[3]={0,0,0};
float impulse[5]={1,0,0,0,0};
main()
int j;
x[0]=impulse[j];
y[2]=y[1];
y[1]=y[0];
Example:
Result:
#include<stdio.h>
int x[15]={1,2,3,4,5,6,0,0,0,0,0,0}; /*Input Signal Samples*/
int h[15]={1,2,3,4,5,6,0,0,0,0,0,0}; /*Impulse Response Co-efficients*/
int y[20];
main()
{ int m=6; /*Length of i/p samples sequence*/
int n=6; /*Length of impulse response Co-efficients */
int i=0,j;
for(i=0;i<m+n-1;i++)
{
y[i]=0;
for(j=0;j<=i;j++)
y[i]+=x[j]*h[i-j];
}
printf("The linear convolution for the two given sequences is\n");
for(i=0;i<m+n-1;i++)
printf("%d\n",y[i]);
}
Example:
To find the linear convolution for the given sequences x(n)={1 2 3 4 5 6} and h(n)={ 1 2 3 4 5 6}
Result:
The linear convolution for the two given sequences is
1 4 10 20 35 56 70 76 73 60 3
Output Plot:
#include<stdio.h>
#include<math.h> int y[10];
main()
{
int x[2]={1,-1};
int h[4]={1,0,-1,0}; int N=4;
int k,i,n; for(n=0;n<N;n++)
{
y[n]=0;
for(k=0;k<N;k++)
{
i=(n-k)%N; if(i<0) i=i+N;
y[n]+=x[k]*h[i];
}
printf("%d\n",y[n]);
}
}
Output:
%Length of the first sequence: 2
%Length of the second sequence: 4
%The first sequence: 1 -1
%The second sequence: 1 0 -1 0
y[0]=1
y[1]=-1
y[2]=-1
y[3]=1
Output Plot:
#include <stdio.h>
#include<math.h>
void main(void)
{
int N=4;
int x[4]={1,0,-1,0};
float pi=3.1416;
float sumre=0,sumim=0; float cosine=0,sine=0;
float out_re[4]={0,0}, out_im[4]={0,0};
int n=0,k=0;
for (k=0;k<N;k++)
{
sumre=0;
sumim=0;
for (n=0;n<N;n++)
{
cosine=cos(2*pi*k*n/N);
sine=sin(2*pi*k*n/N);
sumre=sumre+x[n]*cosine; sumim= sumim-x[n]*sine;
}
out_re[k]=sumre; out_im[k]=sumim;
printf("x[%d]=%7.3f%7.3fj\n",k,out_re[k],out_im[k]);
}
}
Result:
[0]0.0000.000
[1]2.0000.000
[2]0.000-0.000
[3]2.0000.000
#include "L138_LCDK_aic3106_init.h"
#define LOOPLENGTH 48
#define BUFLENGTH 256
int16_t sine_table1[LOOPLENGTH] = { 0, 1305, 2588, 3827, 5000, 6088, 7071, 7934, 8660,
9239, 9659, 9914, 10000, 9914, 9659, 9239, 8660, 7934, 7071, 6088, 5000,
3827, 2588, 1305, 0, -1305, -2588, -3827, -5000, -6088, -7071, -7934,
-8660, -9239, -9659, -9914, -10000, -9914, -9659, -9239, -8660, -7934,
-7071, -6088, -5000, -3827, -2588, -1305 };
int16_t buf_ptr = 0;
return;
}
int main(void)
{
L138_initialise_intr(FS_48000_HZ,ADC_GAIN_0DB, DAC_ATTEN_0DB,LCDK_LINE_INPUT); //
initilize the Codec
while (1);
Output:
#include "L138_LCDK_aic3106_init.h"
#define LOOPLENGTH 64
int16_t square_table[LOOPLENGTH] =
{10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000,
10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000,
10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000,
10000, 10000, 10000, 10000, 10000, 10000, 10000, 10000,
-10000,-10000,-10000,-10000,-10000,-10000,-10000,-10000,
-10000,-10000,-10000,-10000,-10000,-10000,-10000,-10000,
-10000,-10000,-10000,-10000,-10000,-10000,-10000,-10000,
-10000,-10000,-10000,-10000,-10000,-10000,-10000,-10000};
int16_t loopindex = 0;
int main(void)
{
L138_initialise_intr(FS_8000_HZ,ADC_GAIN_0DB,DAC_ATTEN_0DB,LCDK_LINE_INPUT);
while(1);
}
Output:
PROGRAM:
Clc;
Clear all;
Close all;
t = -2:0.05:2;
x=input('enter the input number');
fr1=697;
fr2=770;
fr3=852;
fr4=941;
fc1=1209;
fc2=1336;
fc3=1477;
fc4=1633;
y0 = sin(2*pi*fr4*t) + sin(2*pi*fc2*t); %0
y1 = sin(2*pi*fr1*t) + sin(2*pi*fc1*t); %1
y2 = sin(2*pi*fr1*t) + sin(2*pi*fc2*t); %2
y3 = sin(2*pi*fr1*t) + sin(2*pi*fc3*t); %3
y4 = sin(2*pi*fr2*t) + sin(2*pi*fc1*t); %4
y5 = sin(2*pi*fr2*t) + sin(2*pi*fc2*t); %5
y6 = sin(2*pi*fr2*t) + sin(2*pi*fc3*t); %6
y7 = sin(2*pi*fr3*t) + sin(2*pi*fc1*t); %7
y8 = sin(2*pi*fr3*t) + sin(2*pi*fc2*t); %8
y9 = sin(2*pi*fr3*t) + sin(2*pi*fc3*t); %9
y_start = sin(2*pi*fr4*t) + sin(2*pi*fc1*t); % *
y_canc = sin(2*pi*fr4*t) + sin(2*pi*fc3*t); % #
if (x==1)
plot(t,y1)
xlabel('time(t)')
ylabel('amplitude')
elseif (x==2)
plot(t,y2)
xlabel('time(t)')
ylabel('amplitude')
elseif (x==3)
plot(t,y3)
xlabel('time(t)')
ylabel('amplitude')
elseif (x==4)
plot(t,y4)
xlabel('time(t)')
ylabel('amplitude')
elseif (x==5)
plot(t,y5)
xlabel('time(t)')
ylabel('amplitude')
elseif (x==6)
plot(t,y6)
xlabel('time(t)')
ylabel('amplitude')
elseif (x==7)
plot(t,y7)
xlabel('time(t)')
ylabel('amplitude')
elseif (x==8)
plot(t,y8)
xlabel('time(t)')
ylabel('amplitude')
elseif (x==9)
plot(t,y9)
xlabel('time(t)')
ylabel('amplitude')
elseif (x==0)
plot(t,y0)
xlabel('time(t)')
ylabel('amplitude')
elseif (x==11)
plot(t,y_start)
xlabel('time(t)')
ylabel('amplitude')
elseif (x==12)
plot(t,y_canc)
xlabel('time(t)')
ylabel('amplitude')
else
disp('enter the correct input')
end
INPUT:
Enter the input number = 7
Output Waveform:
VIVA QUESTIONS:
1. Expand DTMF?
2. Define frequency groups for all symbols?
3. Define DTMF?
4. Give the applications of DTMF?
5. Define low frequency group and high frequency group?
Exercise:
1. Generate DTMF signal for the symbols 5, 8, 3 and #.
Algorithm:
Step I : Define down sampling factor and input frequencies f1 and f2
Step II : Represent input sequence with frequencies f1 and f2
Step III : Perform the decimation on input signal using matlab command decimate.
Step IV : Plot the input and output sequence
PROGRAM:
Clc;
Clear all;
Close all;
D=input('enter the downsampling factor');
L=input('enter the length of the input signal');
f1=input('enter the frequency of first sinusodal');
f2=input('enter the frequency of second sinusodal');
n=0:L-1; x=sin(2*pi*f1*n)+sin(2*pi*f2*n);
y=decimate(x,D,'fir');
subplot(2,1,1);
stem(n,x(1:L));
title('input sequence');
xlabel('time(n)');
ylabel('amplitude');
subplot(2,1,2)
m=0:(L/D)-1;
stem(m,y(1:L/D));
title('Decimated sequence');
xlabel('time(n)');
ylabel('amplitude');
INPUT:
enter the downsampling factor = 5
enter the length of the input signal = 100
enter the frequency of first sinusoidal = 0.01
enter the frequency of second sinusoidal = 0.03
Output Waveforms:
VIVA QUESTIONS:
1. Explain about multi rate digital signal processing.
2. List the Applications of multi rate digital signal processing.
3. Define interpolation.
4. Define decimation.
5. Define aliasing
Exercise:
1. Perform Decimation on the input signal x(n)=cos(2*pi*30*n).
Algorithm:
Step I : Define up sampling factor and input frequencies f1 and f2
Step II : Represent input sequence with frequencies f1 and f2
Step III: Perform the interpolation on input signal using matlab command interp.
Step IV : Plot the input and output signal/sequence.
PROGRAM:
Clc;
Clear all;
Close all;
L=input('enter the upsampling factor');
N=input('enter the length of the input signal'); % Length should be greater than 8
f1=input('enter the frequency of first sinusodal');
f2=input('enter the frequency of second sinusodal');
n=0:N-1;
x=sin(2*pi*f1*n)+sin(2*pi*f2*n);
y=interp(x,L);
subplot(2,1,1)
stem(n,x(1:N))
title('input sequence');
xlabel('time(n)');
ylabel('amplitude');
subplot(2,1,2)
m=0:N*L-1;
stem(m,y(1:N*L))
title('output sequence ');
xlabel('time(n)');
ylabel('amplitude');
INPUT:
enter the upsampling factor = 5
enter the length of the input signal = 9
enter the frequency of first sinusoidal = 0.1
enter the frequency of second sinusoidal = 0.3
Output Waveforms:
VIVA QUESTIONS:
1. Explain about multi rate digital signal processing.
2. List the Applications of multi rate digital signal processing.
3. Define interpolation.
4. Define decimation.
5. Define aliasing.
Exercise:
1. Perform interpolation on the input signal x(n)=cos(2*pi*30*n).
VIVA Questions
1. What is Matlab?
2. What are the applications of Matlab?
3. State sampling theorem.
4. What is meant by Nyquist rate and Nyquist criteria?
5. Explain scaling and superposition properties of a system.
6. What is meant by linearity of a system and how it is related to scaling and superposition?
7. What is impulse function?
8. What is meant by impulse response?
9. What is energy signal ? How to calculate energy of a signal?
10. What is power signal ? How to calculate power of a signal?
11. Differentiate between even and odd signals.
12. Explain time invariance property of a system with an example.
13. What is memory less system?
14. When a system is said to have memory?
15. What is causality?
16. Explain linear convolution and circular convolution.
17. What is the length of linear and circular convolutions if the two sequences are having the
unequal lengths?
18. What are Fourier series and Fourier transform?
19. What are the advantages and special applications of Fourier transform, Fourier series, Z-
transforms and Laplace transform?
20. Differentiate between DTFT and DFT. Why it is advantageous to use DFT in computers
rather than DTFT?