DSP Lab File
DSP Lab File
Date Signature
……………….. …………………..
S.No PARTICULARS PAGES DATE REMARKS
01. Develop a program to represent basic elementary
discrete signals.
02. Develop a program to calculate the convolution of
two discrete signals.
03. Develop a program to determine Z-transform of
given discrete signal.
04. Develop a program to determine inverse Z-
transform of given discrete signal.
05. Develop a program to describe discrete LTI system
, obtain its partial fraction and draw its pole-zero
plot.
06. Develop a program to determine impulse & step
response of a discrete system.
07. Develop a program to determine any causal signal
response of a discrete system.
08. Develop a program to determine the frequency
response of discrete LTI system.
09. Develop a program to determine Fast Fourier
Transform of given discrete signal.
10. Develop a program to obtain output response,
pole-zero plot & frequency response of the filter.
1. Devlop a program to represent basic elementary discrete signals.
clc;
close all
t=(0:0.2:10);
subplot(321)
impulse=t==0;
stem(t,impulse)
xlabel('Time Index');
ylabel('Amplitude');
title('Unit Impulse')
subplot(322)
unitstep=t>=0;
stem(t,unitstep)
xlabel('Time Index');
ylabel('Amplitude');
title('Unit Step')
subplot(323)
y3=t;
stem(t,y3)
xlabel('Time Index');
ylabel('Amplitude');
title('Unit Ramp')
subplot(324)
y4=exp(t/2);
stem(t,y4)
xlabel('Time Index');
ylabel('Amplitude');
title('Exponential')
subplot(325)
y5=sin(t);
stem(t,y5)
xlabel('Time index');
ylabel('Amplitude');
title('Sine')
subplot(326)
y6=cos(t);
stem(t,y6)
xlabel('Time Index');
ylabel('Amplitude');
title('Cosine')
1
1. Develop a program to represent basic elementary discrete signals.
1
2
2. Develop a program to calculate the convolution of two discrete
signals.
clc;
close all;
L=length(x1)+length(x2)-1;
n=0:1:L-1;
y=conv(x1,x2);
disp('The Convolution is:')
disp(y)
subplot(313)
stem(n,y);
xlabel('Time Index');
ylabel('Amplitude');
title('Linear Convolution')
Columns 1 through 9
0 0.0001 0.0004 0.0009 0.0019 0.0036 0.0066 0.0115
0.0198
Columns 10 through 18
1
0.0335 0.0562 0.0938 0.1558 0.2582 0.4271 0.7056
1.1650 1.6243
Columns 19 through 27
2.0837 2.5431 3.0024 3.4597 3.9155 4.3689 4.8183
5.2611 5.6932
Columns 28 through 36
6.1074 6.4923 6.8287 7.0853 7.2103 7.1182 6.6684
5.6285 3.6161
>>
2
2. Develop a program to calculate the convolution of two discrete
signals.
1
3. Devlop a program to determine Z-transform of given discrete signal.
clc;
close all;
syms n;
X=ztrans(x);
disp('z transform is:');
disp(X);
Y=iztrans(X);
disp('Inverse z transform is:');
disp(Y);
z transform is:
(2*z)/(z - 2) + (4*z)/(z - 1/2)
>>
1
4. Develop a program to determine inverse Z-transformof given discrete
signal.
clc;
close all;
syms z;
Y=iztrans(x);
disp('Inverse z transform is:');
disp(Y);
X=ztrans(Y);
disp('z transform is:');
disp(X);
z transform is:
(2*z)/(z - 2)^2
>>
1
5. Devlop a program to describe discrete LTI system , obtain its partial
fraction and draw its pole-zero plot.
clc;
close all;
disp('Zeros are:');
zeros=roots(num);
disp(zeros);
disp('Poles are:');
poles=roots(den);
disp(poles);
figure(1);
zplane(num,den);
title('Pole-Zero Plot')
Zeros are: 0
1
z = 0.6000
0.4000
p = 0.7500
-0.5000
k = []
>>
2
5. Devlop a program to describe discrete LTI system, obtain its partial
fraction and draw its pole-zero plot.
1
6. Develop a program to determine impulse & step response of a
discrete system.
clc;
close all;
n=0:0.1:10;
figure(1)
impz(num,den);
title('Impulse Response')
figure(2)
stepz(num,den);
title('Step Response')
Alternate method:-
%subplot(121)
%X1=dimpulse(H,n);
%stem(X1);
%xlabel('Time Index')
%ylabel('Amplitude')
%title('Impulse Response')
%grid on
%subplot(122)
%X2=dstep(H,n);
%stem(X2);
%xlabel('Time Index')
%ylabel('Amplitude')
%title('Step Response')
%grid on;
1
H = z
--------------------
z^2 - 0.25 z - 0.375
>>
2
6. Develop a program to determine impulse & step response of a
discrete system.
1
7. Develop a program to determine any causal signal response of a
discrete system
clc;
close all;
figure(1)
R=lsim(H,X1);
stem(R);
xlabel('Time Index');
ylabel('Amplitude');
title('Response')
grid on
>>
1
7. Develop a program to determine any causal signal response of a
discrete system.
1
8. Develop a program to determine the frequency response of
discrete LTI system.
clc;
close all;
disp('Zeros are:');
zeros=roots(num);
disp(zeros);
disp('Poles are:');
poles=roots(den);
disp(poles);
figure(1);
zplane(num,den);
title('Pole-Zero Plot')
figure(2);
freqz(num,den);
title('Frequency Response');
>>
1
8. Develop a program to determine the frequency response of discrete
LTI system.
1
2
9. Devlop a program to determine Fast Fourier Transform of given
discrete signal.
clc;
close all;
subplot(211);
plot(t,x1);
xlabel('Time Index');
ylabel('Amplitude');
title('Input Signal')
xft=fft(x1,1200);
xabs=abs(xft);
subplot(212);
plot(xabs);
xlabel('Distribution');
ylabel('Magnitude');
title(' fast Fourier Transform')
>>
1
9. Devlop a program to determine Fast Fourier Transform of given
discrete signal.
1
10. Develop a program to obtain the output response , pole-zero
plots & frequency response of the filter.
clc;
close all;
num=input('Enter the coefficient of numerator=');
den=input('Enter the coefficient of denominator=');
n=input('Determine the time index for input sample=');
X=input('Enter the input sample x(n)=');
Y=filter(num,den,X);
figure(1)
zplane(num,den);
title('Pole-Zero Plot')
figure(2)
stem(Y);
xlabel('Time Index')
ylabel('Amplitude')
title('Output Sequence')
figure(3);
freqz(num,den);
title('Frequency Response');
Columns 10 through 18
17.4297 17.9609 18.0264 17.2419 16.0704 14.4833
12.6472 10.5930 8.3910
Column 19
6.0701
>>
1
10. Develop a program to obtain the output response , pole-zero
plots & frequency response of the filter.
1
2