?? problem_6_1.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 + -