⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fig9_38.m

📁 基于WEB与MATLAB编写的信号处理的源码,书名为"应用WEB和MATLAB的信号与系统基础.
💻 M
字号:
% Figure 9.38
%
%  Compares the Butterworth and Chebyshev filters
%
w = 0:.01:8;
fprintf('Butterworth filter: \n')
[z,p,k] = buttap(3);      
[b,a]=zp2tf(z,p,k);
Wo=2;  % change cutoff frequency to 2 rad/s
[b,a] = lp2lp(b,a,Wo)
disp('b = ');disp(b');
disp('a = ');disp(a');
[magb,phaseb] = bode(b,a,w);
%
fprintf('Chebyshev filter: \n')
[z,p,k] = cheb1ap(3,3); 
b=poly(z)*k;          
a=poly(p);
[b,a] = lp2lp(b,a,Wo)
disp('b = ');disp(b');
disp('a = ');disp(a');
[magc,phasec] = bode(b,a,w);
%
clf
subplot(211)
p71=1/sqrt(2);
plot(w,magb,'-',w,magc,'-.',[0 2],[p71 p71],'r--',...
[2 2],[0 p71],'r--')

% the following inserts a legend and adds identifying lines
hold on
plot([3 3.7],[1.1 1.1],[3 3.7],[0.75 0.75],'-.');
ylabel('       |H|')
text(-1.2,p71,'0.707');
text(3.8,1.1,'Three-pole Butterworth');
text(3.8,0.75,'Three-pole Chebyshev');
text(0.5,0.15,'Passband');
hold off
%
subplot(212)
H=plot(w,phaseb,'-',w,phasec,'-.');
ylabel('Phase (deg)')
xlabel('Frequency (rad/sec)')
subplot(111)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -