Professional Documents
Culture Documents
[h,omega]=freqz(b,1,512);
subplot(2,2,4)
plot(omega/(2*pi),20*log10(abs(h)));grid; xlabel('Frequency');ylabel('Gain, dB')
enter the sampling frequency2048
enter the decimation factor32
enter the first decimation factor4
enter the second decimation factor4
enter the third decimation factor2
enter the passband edge frequency30
enter the stopband edge frequency32
enter the magnitude values[1 0]
enter the passband ripple0.00115
enter the stopband ripple0.0001
N=3946;
N1=17;
N2=32;
N3=269;
50
20
0
-20
Gain, dB
Gain, dB
-50
-40
-60
-80
-100
-100
0
0.05
0.1
0.15
0.2
0.25 0.3
Frequency
0.35
0.4
0.45
-120
0.5
50
50
0
Gain, dB
Gain, dB
-150
-50
-100
-150
0.05
0.1
0.15
0.2
0.25 0.3
Frequency
0.35
0.4
0.45
0.5
0.05
0.1
0.15
0.2
0.25 0.3
Frequency
0.35
0.4
0.45
0.5
-50
-100
0.05
0.1
0.15
0.2
0.25 0.3
Frequency
0.35
0.4
0.45
0.5
-150
j=sqrt(-1);
for i=1:len
h1(i)=j^(i)*h0(i);
h2(i)=(-1)^i*h0(i);
h3(i)=(-j)^(i)*h0(i);
end
[H0z,w]=freqz(h0,1,l,'whole');
H0=abs(H0z); M0=20*log10(H0);
[H1z,w]=freqz(h1, 1,l,'whole');
H1=abs(H1z); M1=20*log10(H1);
[H2z,w]=freqz(h2, 1, l,'whole');
H2=abs(H2z); M2=20*log10(H2);
[H3z, w]=freqz(h3, 1, l,'whole');
H3=abs(H3z); M3=20*log10(H3);
plot(w/pi, M0, '-k', w/pi, M1, '--k', w/pi, M2, '--k', w/pi, M3, '-k');grid
xlabel('\omega/\pi'); ylabel('Gain, dB')
Type in the filter length= 25
Type in the value of L =4
enter the number of frequency sample points 512
20
Gain, dB
-20
-40
-60
-80
-100
-120
0.2
0.4
0.6
0.8
1.2
1.4
1.6
1.8