📄 problem_6_1a.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;
w=0:ws/1000:ws;L=length(w);
%================================================================
[N,wc]=buttord(wp,ws,ap,as,'s');
[num,den]=butter(N,wp,'s');
[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 + -