Professional Documents
Culture Documents
SP FINAL
SP FINAL
SP FINAL
Name : …....................................................
Branch : ……………………………………
BONAFIDE CERTIFICATE
Certified that this is the bonafide record of work done in BM3401 SIGNAL PROCESSING by
AIM:
To generate a discrete time signal sequence (Unit step, Unit ramp, Sine, Cosine,
Exponential, Unit impulse) using MATLAB function.
APPARATUS REQUIRED:
SOFTWARE : MATLAB
PROCEDURE:
amplitude
0.5 0.5
0 0
-4 -2 0 2 4 0 2 4 6 8
time period sequence
17
unit ramp x 10 exponential sequence
6 3
amplitude
amplitude
4 2
2 1
0 0
0 2 4 6 0 2 4 6 8
sequence time period
OUTPUT: (CONTINUOUS SIGNALS)
17
x 10 continuous exponential sequence
3
amplitude
0
0 1 2 3 4 5 6 7 8
tisminee pwearivoed
1
amplitude
-1
0 0.5 1 1.5 2 2.5 3 3.5
time period
cosine wave
1
amplitude
-1
0 0.5 1 1.5 2 2.5 3 3.5
time period
RESULT:
Thus the MATLAB programs for discrete time signal sequence (Unit step,
Unit ramp, Sine, Cosine, Exponential, Unit impulse) using MATLAB function written
and the results were plotted.
Ex. No: 2 ANALYSE THE STABILITY OF A CT SYSTEM
Date: WITH VARIOUS INPUTS
AIM:
To write MATLAB programs for analyse the stability of a CT system with various
inputs.
APPARATUS REQUIRED:
PROCEDURE:
6. If any error occurs in the program correct the error and run it again
% Define the
sinusoidal input
u_sine =
sin(2*pi*0.5*t);
Input');xlabel('Time (s)');
ylabel('Amplitude');
RESULT:
Thus, the MATLAB program of analysis of the stability of a CT system with various
input results was obtained.
EXP. NO: 3 ANALYSE THE STABILITY OF A DT SYSTEM WITH VARIOUS INPUTS.
Date :
AIM:
To write a MATLAB program for the analyses the stability of a system with various inputs.
APPARATUS REQUIRED:
PROCEDURE:
%%%%%%Check%%%%%
roots(coeff) %%%%Create the second row of
the Routh Tablesecond_row = [];
for idx = 2:2:length(coeff)
second_row = [second_row,coeff(idx)];
end
while length(second_row) < length(first_row)
second_row = [second_row,0];
end
disp('Second Row')
routh_table = [routh_table;second_row]
routh_table_width = length(first_row);
end
end
if ~unstable
disp('System is Stable')
end
%%%%%%Check%%%%%
roots(coeff)
OUTPUT:
coeff =
1 9 8 10
First row=
route table=
1 8 0
Second row=
route table=
1 8 0
9 10 0
9
Determinant to be computedboth_det =
1 8
9 10
Determinant to be computedboth_det =
1 0
9 0
Determinant to be computedboth_det =
1 0
9 0
1.0000 8.0000 0
9.0000 10.0000 0
6.8889 0 0
divisor =
6.8889
Determinant to be computed
both_det =
9.0000 10.0000
6.8889 0
Determinant to be computed
both_det =
9.0000 0
6.8889 0
Determinant to be computed
both_det =
9.0000 0
6.8889 0
routh_table =
1.0000 8.0000 0
9.0000 10.0000 0
6.8889 0 0
10.0000 0 0
routh_table =
1.0000 8.0000 0
9.0000 10.0000 0
6.8889 0 0
10.0000 0 0
first_column =
1.0000
9.0000
6.8889
10.0000
Syatem is stable
ans=
-8.1707 + 0.0000i
-0.4147 + 1.0256i
-0.4147 - 1.0256i
Result:
Thus, the MATLAB program of analysis of the stability of a DT system with various input results was
obtained.
EXP. NO: 4
Date :
SOFTWARE : MATLAB
PROCEDURE:
6. If any error occurs in the program correct the error and run it again
Result:
Thus, the MATLAB program of reconstruct a signal from samples andstudy the effect of aliasing results was
obtained.
EXP. NO: 5
Date :
SPECTRUM ANALYSIS USING FFT
AIM:
To write a MATLAB program for the spectrum analysis using FFT.
APPRATUS REQUIRED:
HARDWARE : Personal Computer
SOFTWARE : MATLAB
PROCEDURE:
6. If any error occurs in the program correct the error and run it again
Result:
Thus, the MATLAB program of spectrum analysis using FFT results was obtained.
EXP. NO: 6A
Date:
DESIGN OF FIR FILTERS
(RECTANGULAR WINDOW DESIGN)
AIM:
To write a program to design the FIR low pass, High pass, Band pass and Band stop filters
using RECTANGULAR window and find out the response of the filter by using MATLAB.
APPARATUS REQUIRED:
PROCEDURE:
1. Start the MATLAB program.
6. If any error occurs in the program correct the error and run it again
%highpass filter
b=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m);
ylabel('gain in db ..... >');
xlabel('(b)normalized frequency..... >');
%bandpass filter
wn=[wp ws];0
b=fir1(n,wn,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,3);
plot(o/pi,m);
ylabel('gain in db ... >');
xlabel('(c)normalized frequency ... >');
%bandstop filter
b=fir1(n,wn,'stop',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m);
ylabel('gain in db ... >');
xlabel('(d)normalized frequency.... >');
OUTPUT: (Rectangular Window)
Enter the pass band ripple 0.03
Enter the stop band ripple 0.01
Enter the pass band frequency 1400
Enter the stop band frequency 2000
Enter the sampling frequency 8000
-50 -50
-100 -100
0 0.5 1 0 0.5 1
Normalized freqency------> Normalized freqency ----- >
MAGNITUDE RESPONSE OF BPF MAGNITUDE RESPONSE OF BSF
50 20
Gain in db ------ --.
0
0
-20
-50
-40
-100 -60
0 0.5 1 0 0.5 1
Normalized freqency -----> Normalized freqency------>
RESULT:
Thus,the program to design FIR low pass, high pass, band pass and band stop Filters using
RECTANGULAR Window was written and response of the filter using MATLAB was executed.
EXP. NO: 6B
Date:
DESIGN OF FIR FILTERS
(HANNING WINDOW DESIGN)
AIM:
To write a program to design the FIR low pass, High pass, Band pass and Band stop
filters using RECTANGULAR window and find out the response of the filter by using
MATLAB.
APPARATUS REQUIRED:
PROCEDURE:
1. Start the MATLAB program.
6. If any error occurs in the program correct the error and run it again
%lowpass filter
b=fir1(n,wp,Y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m);
ylabel('gain in db ... >');
xlabel('(a)normalized frequency');
%highpass filter
b=fir1(n,wp,'high',Y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m);
ylabel('gain in db .. >');
xlabel('(b)normalized frequency .. >');
%bandpass filter
wn=[wp ws];
b=fir1(n,wn,Y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,3);
plot(o/pi,m);
ylabel('gain in db .... >');
xlabel('(c)normalized frequency ...>');
%bandstop filter
b=fir1(n,wn,'stop',Y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m);
ylabel('gain in db...>');
xlabel('(d)normalized frequency >')
OUTPUT:
n = 21
0
Gain in db --- >
0
-50
-50
-100
-150 -100
0 0.5 1 0 0.5 1
Normalized frequency --- > Normalized frequency --- >
BAND PASS FILTER BAND STOP FILTER
50 5
0
Gain in db--- >
0
-5
-50
-10
-100 -15
0 0.5 1 0 0.5 1
Normalized frequency --- > Normalized frequency --- >
RESULT:
Thus the program to design FIR low pass, high pass, band pass and band stop Filters using
HANNING Window was written and response of the filter using MATLAB was executed.
EXP. NO: 6C
DESIGN OF FIR FILTERS
Date: (HAMMING WINDOW DESIGN)
AIM:
To design a FIR filter using Hamming window with MATLAB 7.0.
APPARATUS REQUIRED:
Hard ware: IBM PC or compatible
Soft ware :Matlab 7.0 or higher
PROCEDURE:
1. Get the pass band and stop band ripple and frequency.
2. Get the sampling frequency.
3. Find the order of filter N.
4. Design the lowpass, High pass, Band pass and Band stop filter.
5. Plot the magnitude response of all the filters.
PROGRAM:
clc;
clear all;
close all;
rp=input('Pass band ripple=');
rs=input('Stop band ripple=');
fs=input('Stop band frequency in rad/sec=');
fp=input('Pass band frequency in rad/sec=');
f=input('Sampling frequency in rad/sec=');
wp=2*fp/f;
ws=2*fs/f;
num=-20*log10(sqrt(rp*rs))-13;
dem=14.6*(fs-fp)/f;
n=ceil(num/dem)
n1=n+1;
if(rem(n,2)~=0);
n1=n;
n=n-1;
end
y=hamming(n1);
%LOW PASS FILTER
b=fir1(n,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m,'k');
ylabel('Gain in db --->');
xlabel('Normalized frequency --->');
title('LOW PASS FILTER')
%HIGH PASS FILTER
b=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m,'k');
ylabel('Gain in db --->');
xlabel('Normalized frequency --->');
title('HIGH PASS FILTER')
%BAND PASS FILTER
wn=[wp,ws];
x=fir1(n,wn,y);
[h,o]=freqz(b,1,256);
subplot(2,2,3);
plot(o/pi,m,'k');
ylabel('Gain in db --->');
xlabel('Normalized frequency --->');
title('BAND PASS FILTER')
%BAND STOP FILTER
b=fir1(n,wn,'stop',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m,'k');
ylabel('Gain in db --->');
xlabel('Normalized frequency --->');
title('BAND STOP FILTER')
OUTPUT:
n = 30
0
Gain in db -- >
Gain in db -- >
0
-50
-50
-100
-150 -100
0 0.5 1 0 0.5 1
Normalized frequency --- > Normalized frequency --- >
BAND PASS FILTER BAND STOP FILTER
50 5
Gain in db -- >
Gain in db -- >
0
0
-5
-50
-10
-100 -15
0 0.5 1 0 0.5 1
Normalized frequency --- > Normalized frequency --- >
RESULT:
Thus, the program to design FIR low pass, high pass, band pass and band stop Filters
using HAMMING Window was written and response of the filter using MATLAB was
executed.
EXP. NO: 6D
Date:
DESIGN OF FIR FILTERS
(BLACKMAN WINDOW DESIGN)
AIM:
To design a FIR filter using Blackmann window with MATLAB 7.0.
APPARATUS REQUIRED:
Hard ware: IBM PC or compatible
Soft ware :Matlab 7.0 or higher
PROCEDURE:
1. Get the pass band and stop band ripple and frequency.
2. Get the sampling frequency.
3. Find the order of filter N.
4. Design the lowpass,Highpass,Band pass and Band stop filter.
5. Plot the magnitude response of all the filters.
PROGRAM OF FIR FILTER USING BLACKMANN WINDOW:
clc;
clear all;
close all;
rp=input('Pass band ripple=');
rs=input('Stop band ripple=');
fs=input('Stop band frequency in rad/sec=');
fp=input('Pass band frequency in rad/sec=');
f=input('Sampling frequency in rad/sec=');
wp=2*fp/f;
ws=2*fs/f;
num=-20*log10(sqrt(rp*rs))-13;
dem=14.6*(fs-fp)/f;
n=ceil(num/dem)
n1=n+1;
if(rem(n,2)~=0);
n1=n;
n=n-1;
end
y=blackman(n1);
%LOW PASS FILTER
b=fir1(n,wp,y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,1);
plot(o/pi,m,'k');
ylabel('Gain in db --- >');
xlabel('Normalized frequency --->');
title('LOW PASS FILTER')
%HIGH PASS FILTER
b=fir1(n,wp,'high',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,2);
plot(o/pi,m,'k');
ylabel('Gain in db --- >');
xlabel('Normalized frequency --->');
title('HIGH PASS FILTER')
%BAND PASS FILTER
wn=[wp,ws];
x=fir1(n,wn,y);
[h,o]=freqz(b,1,256);
subplot(2,2,3);
plot(o/pi,m,'k');
ylabel('Gain in db --- >');
xlabel('Normalized frequency --->');
title('BAND PASS FILTER')
%BAND STOP FILTER
b=fir1(n,wn,'stop',y);
[h,o]=freqz(b,1,256);
m=20*log10(abs(h));
subplot(2,2,4);
plot(o/pi,m,'k');
ylabel('Gain in db --- >');
xlabel('Normalized frequency --->');
title('BAND STOP FILTER')
OUTPUT:
Pass band ripple=0.03
Stop band ripple=0.01
n = 22
0 0
Gain in db --->
Gain in db --->
-50 -50
-100 -100
-150 -150
0 0.5 1 0 0.5 1
Normalized frequency --- > Normalized frequency --- >
BAND PASS FILTER BAND STOP FILTER
50 5
0
Gain in db --- >
0
-50
-5
-100
-150 -10
0 0.5 1 0 0.5 1
Normalized frequency --- > Normalized frequency --- >
RESULT:
Thus, FIR Filter using Blackman window is designed by using Matlab and result was obtained.
EXP. NO: 6E
Date:
DESIGN OF IIR FILTERS
AIM:
To design a Butterworth and chebychev digital IIR filter using MATLAB 7.0.
APPARATUS REQUIRED:
Hard ware: IBM PC or compatible
Soft ware :Matlab 7.0 or higher
PROCEDURE:
1. Start the program and specify the input datas for each type of filters.
2.Find the order of the filter using built function.
3. Find the number and denominator polynomials for calculation of transfer function.
4. Plot the frequency response and gain for low pass,high pass, band pass and band stop IIR butterworth
filter.
5. Stop the program
PROGRAM:
(BUTTERWORTH FILTER)
clc;
clear all;
close all;
N=8;
wn=0.4;
[num,den]=butter(N,wn,'s');
w=(0:0.01:2);
h=freqs(num,den,w);
subplot(2,2,1);
plot(w/2*pi,(abs(h)),'linewidth',2.5);
title('butterworth low pass filter');
grid on;
xlabel('frequency in hz');
ylabel('gain in db');
[num,den]=butter(N,wn,'high','s');
h=freqs(num,den,w);
subplot(2,2,2);
plot(w/2*pi,(abs(h)),'linewidth',2.5);
title('butterworth high pass filter');
grid on;
xlabel('frequency in hz');
ylabel('gain in db');
N=8;
wp=0.4;
ws=0.6;
wn=[wp ws];
[num,den]=butter(N,wn,'s');
h=freqs(num,den,w);
subplot(2,2,3);
plot(w/2*pi,(abs(h)),'linewidth',2.5);
title('butterworth band pass filter');
grid on;
xlabel('frequency in hz');
ylabel('gain in db');
N=8;
wp=0.4;
ws=0.6;
wn=[wp ws];
[num,den]=butter(N,wn,'stop','s');
h=freqs(num,den,w);
subplot(2,2,4);
plot(w/2*pi,(abs(h)),'linewidth',2.5);
title('butterworth band stop filter');
grid on;
ylabel('gain in db');
xlabel('frequency in hz');
OUTPUT:
gain in db
0.5 0.5
0 0
0 1 2 3 4 0 1 2 3 4
frequency in hz frequency in hz
butterworth band pass filter butterworth band stop filter
1.5 1.5
1 1
gain in db
gain in db
0.5 0.5
0 0
0 1 2 3 4 0 1 2 3 4
frequency in hz frequency in hz
PROGRAMS: IIR (CHEBYSHEW FILTER)
% chebyshew filter
% get the input values
rp=input('enter the passband ripple');
rs=input('enter the stopband ripple');
wp=input('enter the passband frequency');
ws=input('enter the stopband frequency');
fs=input('enter the sampling frequency');
w1=2*wp/fs;
w2=2*ws/fs;
%filter order
[n,wn]=cheb1ord(w1,w2,rp,rs);
%lowpass filter
%either coefficient
[b,a]=cheby1(n,rp,wn);
%frequency response
[H,w]=freqz(b,a,512);
subplot(2,2,1);
plot(w,abs(H));
xlabel('normalised frequency');
ylabel('abs(H)');
title('LPF')
%high pass filter
%filter coefficient
[b,a]=cheby1(n,rp,wn,'High');
%frequency response
[H,w]=freqz(b,a,512);
subplot(2,2,2);
plot(w,abs(H));
xlabel('normalised frequency');
ylabel('abs(H)');
title('HPF')
%band pass filter
%filter coefficient
wn1=[w1,w2];
[b,a]=cheby1(n,rp,wn1);
%frequency response
[H,w]=freqz(b,a,512);
subplot(2,2,3);
plot(w,abs(H));
xlabel('normalised frequency');
ylabel('abs(H)');
title('BPF')
%band stop filter
%filter coefficient
wn2= [w1, w2];
%frequency response
[b,a]=cheby1(n,rp,wn2,'stop');
[H,w]=freqz(b,a,512);
subplot(2,2,4);
plot(w,abs(H));
xlabel('normalised frequency');
ylabel('abs(H)');
title('BSF')
OUTPUT:
LPF HPF
1 1
abs(H)
abs(H)
0.5 0.5
0 0
0 1 2 3 4 0 1 2 3 4
normalised frequency normalised frequency
BPF BSF
1 1
abs(H)
abs(H)
0.5 0.5
0 0
0 1 2 3 4 0 1 2 3 4
normalised frequency normalised frequency
RESULT:
Thus, the digital butterworth and
chebychev IIR Filter are designed by using
Matlab program.
EXP. NO:7
Date: FINITE WORD LENGTH EFFECT
AIM:
To write a MATLAB program for the finite word length.
SOFTWARE REQUIRED:
PC with MATLAB
PROCEDURE:
1. Open the MATLAB
2. Open New file
3. Typethe program
4. Save in current directory
5. Compileand run the program
PROGRAM
clc;
clearall
close all;
fs = 1000; % Sampling
frequency t = 0:1/fs:1-
1/fs; % Time vector
x = sin(2*pi*50*t) + sin(2*pi*120*t); % Signal with two frequencies
Result:
Thus the MATLAB program for the finite word length result was obtained.
EXP. NO:8 MULTIRATE SIGNAL PROCESSING
Date:
AIM:
To write a MATLAB program for the multirate signal processing
SOFTWARE REQUIRED:
PC with MATLAB
PROCEDURE:
1. Open the MATLAB
2. Open New file
3. Typethe program
4. Save in current directory
5. Compile and run the program
PROGRAM:
clc;
clos
e
all;
clea
r
all;
% Define the input signal
fs =700; % Sampling frequency
t = 0:1/fs:1-1/fs; % Time vector
x = sin(2*pi*50*t) + sin(2*pi*120*t); % Signal with two frequencies
RESULT:
Thus, the MATLAB program of multirate signal processing results was obtained.
EXP. NO:9A DSP PROCESSOR IMPLEMENTATION (LINEAR
AIM:
To design and implement the circular and linear convolution using TMS320C5410 processor
APPARATUS REQUIRED:
TMS320C5410 processor
Personal computer
PROCEDURE:
1. Open New file
2. Typethe program
3. Save in current directory
4. Compile and run the program
PROGRAM:
Output:
PROGRAM:
OUTPUT:
RESULT:
Thus, the circular and linear convolution and circular convolution was implemented using TMS 320C5416.
EXP. NO:9(B)
Date:
DSP PROCESSOR IMPLEMENTATION
(IIR &FIR FILTER)
AIM:
To design and implement IIR(LPF/HPF) filter using TMS320C5416 processor.
APPRATUS REQUIRED:
TMS320C5416 processor
Personal Computer
PROCEDURE:
1. Open New file
2. Typethe program
3. Save in current directory
4. Compile and run the program
PROGRAM (IIR):
OUTPUT:
PROGRAM (FIR);
OUTPUT:
RESULT:
Thus, the IIR filter and FIRfilter was implemented using TMS320C5416 processor.
EXP. NO:9(C)
Date:
DSP PROCESSOR IMPLEMENTATION
(FFT IMPLEMENTATION)
AIM:
To design and implement FFT filter using TMS320C5416 processor.
APPRATUS REQUIRED:
TMS320C5416 processor.
Personal Computer
PROCEDURE:
1. Open New file
2. Typethe program
3. Save in current directory
4. Compile and run the program
PROGRAM:
RESULT:
Thus, the FFT filter was implemented using TMS 320C5416.