Digital Signal Processing
Digital Signal Processing
INDEX :
1. MATLAB program to generate basic signals.
2. MATLAB program to generate Impulse signal.
3. MATLAB program to evaluate the impulse response
of the system .
4. To study the computation of N point DFT of a given
sequence.
5. Write a program to compute N point DTFT of a
sequence.
6. To study the linear convolution of two given
sequences.
7. To study autocorrelation of a given sequence and
verification.
8. Study Circular convolution of two given sequences.
9. To Design of FIR filters using MATLAB commands
10. To design a Butterworth digital IIR filter using
MATLAB 7.0.
EXPERIMENT NO:- 1
PROGRAM:
1. UNIT STEP SIGNAL
SIGNAL clc; clearall;
closeall;
N=input('Numberof Samples
= '); n=-N:1:N
x=[zeros(1,N) 1 ones(1,N)]
stem(n,x); xlabel('Time');
ylabel('Amplitude'); title('Unit
Step Response');
% 3. UNIT RAMP SIGNAL
clc; clear
all;
close all;
disp('UNIT RAMP SIGNAL');
N=input('Number of Samples = ');
a=input('Amplitude = ') n=-N:1:N
x=a*n stem(n,x); xlabel('Time'
);
ylabel('Amplitude'); title('Unit Ramp
Response');
3.EXPONENTIAL DECAYING
SIGNAL
clc; clear
all;
close
all;
disp('EXPONENTIAL DECAYING
SIGNAL'); N=input('Number of
Samples = '); a=0.5 n=0:.1:N x=a.^n
stem(n,x); xlabel('Time'
);
ylabel('Amplitude');
title('Exponential Decaying Signal Response');
4. EXPONENTIAL GROWING
SIGNAL clc; clear all;
close
all;
disp('EXPONENTIAL GROWING SIGNAL');
N=input('Number of Samples = '); a=0.5
n=0:.1:N
x=a.^n stem(n,x);
xlabel('Time');
ylabel('Amplitude');
title('Exponential Growing Signal Response');
5.COSINE SIGNAL
clc; Clear
all;
close
all;
disp('COSINE SIGNAL');
N=input('Number of Samples = ');
n=0:.1:N x=cos(n) stem(n,x);
xlabel('Time'); ylabel('Amplitude
');
title('Cosine Signal');
6. SINE SIGNAL
clc; clear all;
close all;
disp('SINE
SIGNAL');
N=input('Number of
Samples = '); n=0:.1:N
x=sin(n) stem(n,x);
xlabel('Time'
);
ylabel('Amplitude
'); title('sine
Signal');
EXPERIMENT NO. 2
EXPERIMENT NO. 3
AIM:- To write a MATLAB program to evaluate the impulse response of the system .
EQUIPMENTS:
close all;
of y(n),y(n-1)----');
[h,t]=impz(b,a,N); subplot(2,1,1);
xlabel('time index----->N');
ylabel('amplitude'); xlabel('time
Output :
Enter the coefficients of x(n),x(n-1)-----[1 0.5 0.85] enter the coefficients of y(n),y(n-1)-----[1 -1
-1]
1.1000
2.5000
3.3500
4.8500
GRAPH:
RESULT: The impulse response of given Differential equation is obtained. Hence the theory
and practical value are proved.
EXPERIMENT NO: 4
AIM: To study the computation of N point DFT of a given sequence and to plot
magnitude and phase spectrum.
APPARATUS REQUIRED:
System with MATLAB 7.0.
PROGRAM:
N = input('Enter the the value of N(Value of N in N-Point DFT)'); x =
input('Enter the sequence for which DFT is to be calculated'); n=[0:1:N-1];
k=[0:1:N-1];
WN=exp(-1j*2*pi/N); nk=n'*k;
WNnk=WN.^nk;
Xk=x*WNnk;
MagX=abs(Xk) % Magnitude of calculated DFT
PhaseX=angle(Xk)*180/pi % Phase of the calculated DFT figure(1);
subplot(2,1,1); plot(k,MagX); subplot(2,1,2); plot(k,PhaseX);
OUTPUT
Enter the the value of N(Value of N in N-Point DFT)4
Enter the sequence for which DFT is to be calculated
[1 2 3 4]
MagX = 10.0000 2.8284 2.0000 2.8284
PhaseX = 0 135.0000 -180.0000 -135.0000
DFT of the given sequence is
10.0000 -2.0000 + 2.0000i -2.0000 - 0.0000i -2.0000 -
2.0000i
RESULT: We have study the computation of N point DFT of a given sequence and
also plot magnitude and phase.
EXPERIMENT NO. 5
Apparatus :
System with MATLAB 7.0.
Program :
clc;
ylabel('Phase, radians');
Output :
EXPERIMENT NO. 6
Output :
AIM :To study autocorrelation of a given sequence and verification of its properties.
APPARATUS REQUIRED :
System with MATLAB 7.0.
PROGRAM :
% Read the signal
x=[1,2,3,6,5,4] %
define the axis
n=0:1:length(x)-1 %
plot the signal
stem(n,x); xlabel('n');
% auto correlate the signal
Rxx=xcorr(x,x);
% the axis for auto correlation results nRxx=-
length(x)+1:length(x)-1 % display the result
stem(nRxx,Rxx)
% properties of Rxx(0) gives the energy of the signal
% find energy of the signal energy=sum(x.^2)
%set index of the centre value
centre_index=ceil(length(Rxx)/2) % Acces
the centre value Rxx(0)
Rxx_0==Rxx(centre_index)
Rxx_0==Rxx(centre_index) % Check if the
Rxx(0)=energy if Rxx_0==energy
disp('Rxx(0) gives energy proved'); else
disp('Rxx(0) gives energy not proved'); end
Rxx_right=Rxx(centre_index:1:length(Rxx))
Rxx_left=Rxx(centre_index:-1:1) if
Rxx_right==Rxx_left disp('Rxx is even'); else
disp('Rxx is not even'); end OUTPUT:-
x = 1 2 3 6 5 4 n = 0 1 2 3 4 5 nRxx
= -5 -4 -3 -2 -1 0 1 2 3 4
5 energy= 91
centre_index = 6
Rxx(0) gives energy not proved
Rxx_right =
91.0000 76.0000 54.0000 28.0000 13.0000 4.0000
Rxx_left =
91.0000 76.0000 54.0000 28.0000 13.0000 4.0000
Rxx is even
RESULT : Autocorrelation of a given sequence and its properties has been proved.
EXPERIMENT NO: 8
PROGRAM :
App. 1 Window function method
f1=100;f2=200;%the frequencies of sines signal that needs filtered
fs=2000;%sampling frequency
EXPERIMENT NO. 10