📄 iir.m
字号:
Wp=4000/40000;
Ws=8000/40000;
Rp=0.5;
Rs=40;
[N1,Wn1]=buttord(Wp,Ws,Rp,Rs) %巴特
[N2,Wn2]=cheb1ord(Wp,Ws,Rp,Rs) %切比1
[N3,Wn3]=cheb2ord(Wp,Ws,Rp,Rs) %切比2
[N4,Wn4]=ellipord(Wp,Ws,Rp,Rs) %椭圆
[num1,den1]=butter(N1,Wn1);
[num2,den2]=cheby1(N2,Rp,Wn2);
[num3,den3]=cheby2(N3,Rs,Wn3);
[num4,den4]=ellip(N4,Rp,Rs,Wn4);
[h1,w]=freqz(num1,den1);
subplot(2,1,1);
plot(w/pi,20*log10(abs(h1)));grid
axis([0,1,-300,10]);
xlabel('w/pi');
ylabel('Butterworth Magnitude(DB)');
subplot(2,1,2);
plot(w/pi,angle(h1));grid
xlabel('w/pi');
ylabel('Phase(rad)');
pause;
[h2,w]=freqz(num2,den2);
subplot(2,1,1);
plot(w/pi,abs(h2));grid
xlabel('w/pi');
ylabel('Chebyshev1 Magnitude');
subplot(2,1,2);
plot(w/pi,angle(h2));grid
xlabel('w/pi');
ylabel('Phase(rad)');
pause;
[h3,w]=freqz(num3,den3);
subplot(2,1,1);
plot(w/pi,abs(h3));grid
xlabel('w/pi');
ylabel('Chebyshev2 Magnitude');
subplot(2,1,2);
plot(w/pi,angle(h3));grid
xlabel('w/pi');
ylabel('Phase(rad)')
pause;
[h4,w]=freqz(num4,den4);
subplot(2,1,1);
plot(w/pi,abs(h4));grid
xlabel('w/pi');
ylabel('Elliptic Magnitude');
subplot(2,1,2);
plot(w/pi,angle(h4));grid
xlabel('w/pi');
ylabel('Phase(rad)');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -