iir_2type_sub.m
来自「很多matlab的源代码」· M 代码 · 共 72 行
M
72 行
switch get (wq1 ,'Value')
case 1
subplot(1,1,1);
Wp = 0.2*pi;
Ws = 0.3*pi;
Rp = 7;
As = 16;
[b,a] = afd_butt(Wp,Ws,Rp,As);
[C,B,A] = sdir2cas(b,a)
[db,mag,pha,w] = freqs_m(b,a,0.5*pi);
subplot(3,2,3);
plot(w/pi,mag);grid
xlabel('w');
ylabel('|H|');
title('幅度响应');
axis([0 0.5 0 1.2]);
subplot(3,2,4);
plot(w/pi,db);grid
xlabel('w');
ylabel('dB');
title('幅度的dB');
axis([0 0.5 min(db) max(db)+2])
subplot(3,2,5);
plot(w/pi,pha);grid
xlabel('w');
ylabel('rad');
title('相位响应');
axis([0 0.5 min(pha) max(pha)])
[ha,x,t] = impulse(b,a);
subplot(3,2,6);
plot(t,ha);grid
xlabel('t');
ylabel('h(t)');
title('脉冲响应');
axis([0 30 min(ha) max(ha)])
case 2
subplot(1,1,1);
Wp = 0.2*pi;
Ws = 0.3*pi;
Rp = 1;
As = 16;
Ripple = 10^(-Rp/20);
Attn = 10^(-As/20);
[b,a] = afd_chb1(Wp,Ws,Rp,As);
[C,B,A] = sdir2cas(b,a)
[db,mag,pha,w] = freqs_m(b,a,0.5*pi);
subplot(3,2,3);
plot(w/pi,mag);grid
xlabel('w');
ylabel('|H|');
title('幅度响应');
axis([0 0.5 0 1.2]);
subplot(3,2,4);
plot(w/pi,db);grid
xlabel('w');
ylabel('dB');
title('幅度的dB');
axis([0 0.5 min(db) max(db)+2])
subplot(3,2,5);
plot(w/pi,pha);grid
xlabel('w');
ylabel('rad');
title('相位响应');
axis([0 0.5 min(pha) max(pha)])
[ha,x,t] = impulse(b,a);
subplot(3,2,6);
plot(t,ha);grid
xlabel('t');
ylabel('h(t)');
title('脉冲响应');
axis([0 30 min(ha) max(ha)])
end
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?