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

📄 problem_6_1.m

📁 经典《信号与系统》教程的matlab例程,对深入理解信号与系统相关概念有很大帮助
💻 M
字号:
% Name:problem_6_1
clear
format long
fp=6000;%input('Type in the passband edge frequency fp=');
fs=12000;%input('Type in the stopband edge frequency fs=');
ap=3;%input('Type in the attenuation in passband ap=');
as=25;%input('Type in the attenuation in stopband as=');
wp=2*pi*fp;
ws=2*pi*fs;
%================================================================
[N,wc]=buttord(wp,ws,ap,as,'s');
[z,p,k]=buttap(N);
[nump,denp]=zp2tf(z,p,k);
num=nump;den=denp;
for m=1:N;
    den(m+1)=den(m+1)*wc^(m);
    num(m+1)=num(m+1)*wc^(m);
end
[H,wa]=freqs(num,den);
M=max(abs(H));
subplot(221)
plot(wa/(2*pi),abs(H)),grid on
axis([0,fs,0,max(abs(H))]),
title('The magnitude response')
xlabel('Frequency in Hz')
subplot(222)
plot(wa/(2*pi),20*log10(abs(H)/M))
title('The magnitude response in dB')
xlabel('Frequency in Hz')
axis([0,fs,-60,0]),grid on
%=================================================

⌨️ 快捷键说明

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