Professional Documents
Culture Documents
Lab: DSP
EXPERIMENT No. 1
t = -pi:.0001:pi;
y =cos(t),
plot(t,y);
xlabel(‘t’);
ylabel(‘cos(t)’);
title(‘cos’);
Practical Manual
Lab: DSP
EXPERIMENT No. 2
PROGRAM NO -2
AIM:-To represent exponential signal using MATLAB
x = -pi:O.O1:pi;
plot(x,sin(x)),
xlabel(‘x’);
ylabel(‘sinx’);
title(‘exponential’);
AIM:-
To represent parabolic signal using MATLAB.
N=50;
n-50:1: N-1;
x=n.ˆ2;
plot(n,x);
xlabel(‘n’);
ylabel(‘x(n)’);
title(‘parabolic’);
AIM: -
To represent ramp signal using MATLAB.
x = -pi:O.O1:pi;
plot(x, sin(x)),
xlabel(‘x’);
ylabel(‘sinx’);
title(‘ramp’);
AIM:-
To design analog low pass filter.
clear all;
clc;
rp = input(‘pass ripple freq’);
rs = input(‘stop ripple freq’);
fp = Input(‘pass band freq’);
fs = input(‘stop band freq’);
f = input(‘sample freq’);
w1= 2*fp/f;
w2=2*fs/f;
[n,wn]= buttord(w1 ,w2,rp,rs);
[z,p,k]=butter(n,wn);
[b,a]=zp2tf(z,p,k);
[b,a]= butter(n,wn);
w=0:0.1:pi;
[h,p]= freqz(b,a,w);
g= 20* log 10(abs(h));
A=angle(h);
subplot (2,2,1); plot(p/pi,g);
ylabel(‘amp’);
xlabel(‘ferq’);
title(‘amp,freq’);
subplot (2,2,2); plot(p/pi,A);
xlabel(‘normal. freq’);
ylabel(‘phase’);
title(‘normal. freq,phase’);
rp = 0.5000
rs= 40
fs= 3000
sample freq10000
f= 10000
w1 = 0.4000
w2 = 0.6000
n=9
wn =0.43 92
z=-1
—1
—1
—1
—1
—1
—1
—1
—1
AIM:-
To design analog high pass filter.
clear all;
clc;
rp = input(‘pass ripple freq’);
rs = input(‘stop ripple freq’);
fp = input(‘pass band freq’);
fs = input(‘stop band freq’);
f= input(‘sample freq’);
w1= 2*fp/f;
w2= 2*fs/f;
[n,wn]= buttord(w1 ,w2,rp,rs);
[b,a]= butter(n,wn ‘high’);
w=0:0.1 :pi;
[h,p]= freqz(b,a,w);
g= 20*log10(abs(h));
A=angle(h);
subplot (2,2,1); plot(p/pi,g);
ylabel(‘amp’);
xlabel(‘ferq’);
title(‘amp,freq’);
subplot (2,2,2); plot(p/pi,A);
xlabel(‘normal. freq’);
ylabel(‘phase’);
title(‘normal. Freq,phase’);
AIM:-
To design analog band pass filter.
clear all;
clc;
rp = input(‘pass ripple freq’);
rs = input(‘stop ripple freq’);
fp = input(‘pass band freq’);
fs = input(‘stop band freq’);
f = input(‘sample freq’);
w1 = 2*fp/f;
w2= 2*fs/f;
[nJ= buttord(w1 ,w2,rp,rs);
wn= [w1,w2];
[b,a]= butter(n,wn,’bandpass’);
w=0:0.1:pi;
[h,p]= freqz(b,a,w);
g= 20*log10(abs(h));
A=angle(h);
subplot (2,2,1); plot(p/pi,g);
ylabel(‘amp’);
xlabel(‘ferq’);
title(‘amp,freq’);
subplot (2,2,2); plot(p/pi,A);
xlabel(‘normal. freq’);
ylabel(‘phase’);
title(‘normal. freq,phas&);
rp=0.5000
rs= 40
fs= 3000
sample freql0000
w1 =0.4000
w2= 0.6000
n= 9
wn = 0.4000 0.6000
b= 1.0e-003 *
Columns 1 through 4
0.0064 0 -0.0572 0
Columns 5 through 8
0.2287 0 -0.5336 0
AIM:-
To design analog band stop filter.
clear all;
clc;
rp = input(‘pass ripple freq’);
rs = input(‘stop ripple freq’);
fp = input(‘pass band freq’);
fs = input(‘stop band freq’);
f= input(‘sample freq’);
w1= 2*fp/f;
w2= 2*fs/f
[n]= buttord(w1,w2,rp,rs);
wn=[w1,w2];
[b,a] = butter(n,wn,’stop’);
w=0:0.1:pi;
[h,p]= freqz(b,a,w);
g= 20*log10(abs(h));
A=angle(h);
subplot (2,2,1); plot(p/pi,g);
ylabel(‘amp’);
xlabel(‘ferq’);
title(‘amp,freq’);
subplot (2,2,2); plot(p/pi,A);
xlabel(‘normal. freq’);
ylabel(‘phase’);
title(‘normal. freq,phase’);
rp= 0.5000
rs= 40
fs=3000
f= 10000
w1 =0.4000
w2 = 0.6000
n=9
wn = 0.4000 0.6000
b=
Columns 1 through 4
0.1574 -0.0000 1.4163 -0.0000
Columns 5 through 8
5.6653 -0.0000 13.2190 -0.0000
AIM: -
clear all;
clc;
rp = input(‘pass ripple freq’);
rs = input(‘stop ripple freq’);
fp = input(‘pass band freq’);
fs = input(‘stop band freq’);
f = input(‘sample freq’);
w1=2*fp/f;
w2=2*fs/f;
[n,wn]= buttord(w1,w2,rp,rs);
[b,a] = butter(n,wn);
w=0:.1:pi;
[h,p] = freqz(b,a,w);
g=20*log10(abs(h));
A=angle(h);
subplot (2,2,1); plot(p/pi,g);
ylabel(‘amp’);
xlabel(‘ferq’);
title(‘amp,freq’);
subplot (2,2,2); plot(p/pi,A);
xlabel(‘normal. freq’);
ylabel(‘phase’);
title(‘normal.freq,phase’);
rp=0.5000
rs =40
fp = 2000
fs =3000
f= 10000
w1 =0.4000
w2 =0.6000
n=9
b = Columns 1 through 4
0.0021 0.0186 0.0745 0.1739
Columns 5 through 8
0.2609 0.2609 0.1739 0.0745
Columns 9 through 10 ,Z
0.0186 0.0021
a= Columns 1 thi4
PROGRAM NO-11
AIM:-
rs = 40
fp= 2000
fs= 3000
sample freql0000
f = 1000
w1 = 0.4000
w2=0.6000
n=9
wn= 0.4392
b = Columns 1 through 4
0.0117 -0.1051 0.4204 -0.9809
Columns 9 through 10
0.1051 -0.0117
PROGRAM NO —12
AIM:-
clear all;
rp=0.5000
rs =40
fp=2000
fs= 3000
sample freql0000
f= 10000
w1= 0.4000
w2 = 0.6000
n= 9
wn =0.4000 0.6000
b=1.0e-003 *
Columns 1 through 4
0.0064 0 -0.0572 0
Columns 9 through 12
0.8003 0 -0.8003 0
Practical Manual
Lab: DSP
EXPERIMENT No.13
PROGRAM NO -13
AIM: -
clear all;
clc;
rp = input(‘pass ripple freq’);
rs = input(‘stop ripple freq’);
fp = input(‘pass band freq’);
fs = input(‘stop band freq’);
f = input(‘sample freq’);
w1 2*fp/f;
w2= 2*fs/f;
[n] = buttord(w1,w2,rp,rs);
wn = [w1,w2j;
[b,a] butter(n,wn,’stop’);
w=0:.1:pi;
[h,pJ = freqz(b,a,w);
g= 20*log10(abs(h));
A = angle(h);
subplot (2,2,1); plot(p/pi,g);
ylabel(‘amp’);
xlabel(‘Terq’);
title(‘amp,freq’);
subplot (2,2,2); plot(p/pi,A);
xlabel(‘normal. freq’);
ylabel(‘phase’);
title(‘normal. freq,phase’);
rp=0.5000
rs =40
fp= 200
fs= 3000
sample freq1000
f= 10000
w1 =0.0400
w2 =0.6000
n=2
wn = 0.0400 0.6000
Columns 1 through 4
0.2398 -0.8062 1.1573 -0.8062
Column 5
0.2398
Practical Manual
DIGITAL SIGNAL PROCESSING LAB (ECE-429-F)
Lab: DSP
EXPERIMENT No.14
PROGRAM NO -14
Practical Manual
DIGITAL SIGNAL PROCESSING LAB (ECE-429-F)
Lab: DSP
EXPERIMENT No.15
AIM:
1 2 3 4 5
y=
2 3 4 5 6
C=
2 7 16 30 50 58 49 30
C=
1 2 3 4 5 0 0 0 0
0 1 2 3 4 5 0 0 0
0 0 1 2 3 4 5 0 0
0 0 0 1 2 3 4 5 0
0 0 0 0 1 2 3 4 5
x=
1 2 3 4 5
y=
2 3 4 5 6
c=
2 7 16 30 50 58 58 49 30