📄 iir.m
字号:
wp1=0.45*pi;wp2=0.65*pi;Ap=1;
ws1=0.3*pi;ws2=0.75*pi;As=40;
B=wp2-wp1;
w0=sqrt(wp1*wp2);
Ws1=(ws2.^2-w0.^2)./(B*ws1);
Ws2=(ws2.^2-w0.^2)./(B*ws2);
Ws=min(Ws1,Ws2);
Ws=Ws/pi;
[N,Wc]=buttord(1,Ws,Ap,As,'s');
[num,den]=butter(N,Wc,'s');
Ws1=tan(ws1/2);
Ws2=tan(ws2/2);
W0=sqrt(Ws1*Ws2);
[numt,dent]=lp2bp(num,den,W0,B);
[numt,dent]=bilinear(numt,dent,0.5);
w=linspace(0,2*pi,512);
h=freqz(numt,dent,w);
subplot(2,2,1)
plot(w/pi,20*log10(abs(h)));
title('IIR')
grid;
subplot(2,2,2)
plot(w/pi,abs(h));
title('幅频');
grid
subplot(2,2,3)
plot(w/pi,angle(h));
title('相频');
grid
subplot(2,2,4)
stem(impz(numt,dent,80));
title('冲激响应')
grid
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -