Omegap=0.2*pi;
Omegar=0.3*pi;
Ap=10;
Ar=20;
T=1;
[b,a]=afd_butt(Omegap,Omegar,Ap,Ar);
[C,B,A]=sdir2cas(b,a);
[db,mag,pha,Omega]=freqs_m(b,a,0.5*pi);
[ha,x,t]=impulse(b,a);
N=ceil((log10((10^(0.1*Ar)-1)/(10^(0.1*Ap)-1)))/(2*log10(Omegar/Omegap)))
subplot(321);plot(Omega/pi,mag);title('幅度响应|Ha(j\Omega)|');grid on
subplot(322);plot(Omega/pi,db);title('幅度响应(dB)');grid on
subplot(323);plot(Omega/pi,pha/pi);title('相位响应');grid on
subplot(324);plot(t,ha);title('单位脉冲响应ha(t)');grid on;hold on
axis([0,max(t),min(ha),max(ha)]);
[bd,ad]=imp_invr(b,a,T)
[db,mag,pha,Omega]=freqs_m(b,a,2*pi);
[db,mag,pha,w]=freqz_m(b,a);
subplot(325);plot(Omega/pi,db,w/pi,db);title('幅度特性');grid on
[R,p,k]=residuez(bd,ad)
he=impz(bd,ad,31);
subplot(324);stem([0:30],he);title('单位脉冲响应he(n)');grid on
%h=[he,fliplr(he)]
研学论坛是专业论坛
推荐你去
“研学论坛”求助
那里更专业些
Omegap=0.2*pi;
Omegar=0.3*pi;
Ap=10;
Ar=20;
T=1;
[b,a]=afd_butt(Omegap,Omegar,Ap,Ar);
[C,B,A]=sdir2cas(b,a);
[db,mag,pha,Omega]=freqs_m(b,a,0.5*pi);
[ha,x,t]=impulse(b,a);
N=ceil((log10((10^(0.1*Ar)-1)/(10^(0.1*Ap)-1)))/(2*log10(Omegar/Omegap)))
subplot(321);plot(Omega/pi,mag);title('幅度响应|Ha(j\Omega)|');grid on
subplot(322);plot(Omega/pi,db);title('幅度响应(dB)');grid on
subplot(323);plot(Omega/pi,pha/pi);title('相位响应');grid on
subplot(324);plot(t,ha);title('单位脉冲响应ha(t)');grid on;hold on
axis([0,max(t),min(ha),max(ha)]);
[bd,ad]=imp_invr(b,a,T)
[db,mag,pha,Omega]=freqs_m(b,a,2*pi);
[db,mag,pha,w]=freqz_m(b,a);
subplot(325);plot(Omega/pi,db,w/pi,db);title('幅度特性');grid on
[R,p,k]=residuez(bd,ad)
he=impz(bd,ad,31);
subplot(324);stem([0:30],he);title('单位脉冲响应he(n)');grid on
%h=[he,fliplr(he)]