📄 cai4.m
字号:
disp('请输入有关的参数')
fp=input('fp的值');
fs=input('fs的值');
ap=input('ap的值');
as=input('as的值');
wp=fp*2*pi;
ws=fs*2*pi;
[N,Wc]=cheb1ord(wp,ws,ap,as,'s');
[b,a]=cheby1(N,ap,Wc,'s');
w=linspace(1,400,100)*2*pi;
H=freqs(b,a,w);
magH=abs(H);
m=20*log10(magH);
e=sqrt(1/(10.^(0.1*ap)));
r=1/sqrt(1+e^2);
subplot(2,1,1)
plot(w/(2*pi),m);hold on
plot([fs,fs],[-as,-200],'-.r');hold on
plot([0,400],[-as,-as],'-.r');hold on
plot([fp,fp],[-200,0],'-.y');hold on
axis([0,200,-180,0])
title('切比雪夫I型低通滤波器');
xlabel('频率(Hz)');ylabel('增益20log|H(esp(jw))| (dB)');grid on
subplot(2,1,2)
plot(w,magH);hold on
title('切比雪夫I型低通滤波器的幅频特性');
xlabel('w(rad)');ylabel('幅度|H(jw)|');
plot([0,wp],[r,r],'-.r');hold on
text(0,r,'1/sqrt(1+e^2)');
text(wp,0,'wp');
text(ws,0,'ws');
axis([0,1300,0,1])
grid on
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -