a部分:
wn=pi/3;% Cutoff-frequency
R=100;% Sidelobe attenuation
for i=1:3
switch i
case 1
N=20;% Filter orders
case 2
N=50;
case 3
N=150;
end
window=chebwin(N+1,R);% Chebyshev window
b=fir1(N,wn/pi,window);% FIR filter
figure(i);
freqz(b,1,512);%
title(['Filter order N= ',num2str(N)])
end
b部分:
wn=pi/3;% Cutoff-frequency
N=50;% Filter orders
for i=1:4
R=i*50;% Sidelobe attenuation
window=chebwin(N+1,R);% Chebyshev window
b=fir1(N,wn/pi,window);% FIR filter
figure(4);
subplot(2,2,i)
[H,w]=freqz(b,1,512);
mag=abs(H);
plot(w/pi,20*log10(mag/max(mag)));
xlabel('Normalized Frequency')
ylabel('Magnitude (dB)')
title(['Sidelobe attenuation R= ',num2str(R)])
grid on;
end
从图上可以看出,随着阻带衰减增加,通带波纹没有变化,过渡带随着变缓.说明小幅的旁瓣和窄的主瓣,两者不能同时满足.
c部分:
从a部分的图可以看出,随着滤波器阶数N增加,虽然起伏振荡变密,但通带最大波纹及阻带最大衰减均保持不变,这种现象称为吉布斯(Gibbs)效应