Вы находитесь на странице: 1из 4

ECE107L – A12

Sabuco, Mari Karlo R. karlo_5577@yahoo.com

Madrid, Estelito III S. FinalOption23@yahoo.com

MODULE 4: FAMILIARIZATION OF INFINITE IMPULSE RESPONSE (IIR)

AND POLE-ZERO RESPONSE FILTERS

29
1. fs=30000; 0

fc=5000;

Magnitude (dB)
-100
fsb=10000;
-200
Rp=0.1;
-300
Rs=60;
Wp=2*fc/fs; -400
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Ws=2*fsb/fs; Normalized Frequency ( rad/sample)
0
[N,Wn]=buttord(Wp,Ws,Rp,Rs)
Phase (degrees)

[B,A]=butter(N,Wn) -200

-400
Filter Order (N) = 8
-600
B=
-800
0.0023 0.0186 0.0652 0.1305 0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
0.1631 0.1305 0.0652 0.0186
0.0023
A=
1.0000 -1.5650 2.0512 -1.4970 zplane(B,A)
0.8488 -0.3101 0.0797 -0.0119
0.0008

2. freqz(B,A)
0.8
1
0.6

0.4

Magnitude (dB)
0.8
0.2

0
0.6
-0.2

-0.4
0.4
-0.6
Imaginary Part

0.18 0.2 0.22 0.24 0.26 0.28 0.3 0.32 0.34


0.2 Normalized Frequency ( rad/sample)

0 0

-100
-0.2 -200

Phase (degrees)
-300
-0.4
-400

-500
-0.6
-600

-700
-0.8
-800
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
-1

-1 -0.5 0 0.5 1 What do you observe?


Real Part
Ripples were seen in the passband
Is the plot different from the FIR filters? region. It is observed in the graph that the
Explain. chebyshev posses a higher roll-off rate than the
Butterworth filter. In addition, there are ripples
Answer: Yes, since it has different set of points in the pass band of the chebyshev filter.
and it has X marks on it.
4. fc=5000;
3. [B1,A1]=cheby1(N,Rp,Wn);
fs=30000;
freqz(B,A)
fsb=7500;
hold on
Rs=30;
freqz(B1,A1)
0 R=0.1;
-50

-100
Ws=2*fsb/fs;
Wp=2*fc/fs;
Magnitude (dB)

-150

-200

-250 [N,Wn]=cheb2ord(Wp,Ws,R,Rs)
-300

-350
[B2,A2]=cheby2(N,Rs,Wn);
-400
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
freqz(B2,A2)
Normalized Frequency ( rad/sample)

-100

-200
Phase (degrees)

-300

-400

-500

-600

-700

-800
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
0 500

-20 450
Magnitude (dB)

-40 400
-60
350
-80
300
-100
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
250
Normalized Frequency ( rad/sample)
200
100
150
0
Phase (degrees)

-100 100

-200 50

-300 0
0 1000 2000 3000 4000 5000 6000 7000 8000 9000 10000
-400
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
6. pass1=3000*(2*pi/20000);
pass2=6500*(2*pi/20000);
pass3=8500*(2*pi/20000);
5. t=[0:1999]/(20000/2); stop1=0;
ytest=rand(1,2000)+2*sin(2*pi*2000*t) stop2=4800*(2*pi/20000);
+2*sin(2*pi*3700*t)+2*sin(2*pi*6000* stop3=7200*(2*pi/20000);
t)+2*sin(2*pi*7000*t)+2*sin(2*pi*9000 stop4=9999*(2*pi/20000);
*t); [x,y]=pol2cart(pass1,0.13);
plot(t,ytest) p1=x+y*i;
8 [x,y]=pol2cart(pass2,0.65);
p2=x+y*i;
6
[x,y]=pol2cart(pass3,0.67);
4 p3=x+y*i;
p=[p1 conj(p1) p2 conj(p2) p3 conj(p3)]
2
a=poly(p)
0
[x,y]=pol2cart(stop1,0);
[x,y]=pol2cart(stop1,0.99);
-2 s1=x+y*i;
[x,y]=pol2cart(stop2,0.97);
-4
s2=x+y*i;
-6 [x,y]=pol2cart(stop3,0.97);
0 0.02 0.04 0.06 0.08 0.1 0.12 0.14 0.16 0.18 0.2
s3=x+y*i;
z=fft(ytest,512);
[x,y]=pol2cart(stop4,0.99);
w=(0:255)/256*(20000/2);
s4=x+y*i;
plot(w,abs([z(1:256)']))
s=[s1 s2 conj(s2) s3 conj(s3) s4 conj(s4)]
b=poly(s)
freqz(b,a)

p=
20

Columns 1 through 5

Magnitude (dB)
0

-20

0.0764 + 0.1052i 0.0764 - 0.1052i - -40

0.2043 + 0.4010i -0.2043 - 0.4010i - -60


0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)
0.5970 + 0.3042i 100

50

Phase (degrees)
0
Column 6 -50

-100

-0.5970 - 0.3042i -150


0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
Normalized Frequency ( rad/sample)

8.
s=
signalfilter= filter(b,a,ytest);
yfilter= fft(signalfilter, 512);
Columns 1 through 5
w=(0:255)/(256*(20000/2));
0.9900 0.0609 + 0.9681i
9.
0.0609 - 0.9681i -0.6183 + 0.7474i -
0.6183 - 0.7474i 1400

1200

Columns 6 through 7 1000

800
-0.9900 + 0.0003i -0.9900 - 0.0003i
600

400

200

0
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
a= -4
x 10

plot(w,abs([yfilter(1:256)']))
1.0000 1.4497 0.9112 0.2782
0.0452 -0.0067 0.0015 ANSWER: The magnitudes of
b= the output waveform decreased.

1.0000 2.1048 1.8547 0.6999 -


0.8547 -1.8313 -1.8854 -0.8590
7.

Вам также может понравиться