?? ch3example1b.m
字號:
% ch3example1B.m
clear;
f_p=2400; f_s=5000; R_p=3; R_s=25; % 設計要求指標
[n, fn]=ellipord(f_p,f_s,R_p,R_s,'s'); % 計算階數和截止頻率
Wn=2*pi*fn; % 轉換為角頻率
[b,a]=ellip(n,R_p,R_s,Wn,'s'); % 計算H(s)
f=0:100:10000; % 計算頻率點和頻率范圍
s=j*2*pi*f; % s=jw=j*2*pi*f
H_s=polyval(b,s)./polyval(a,s); % 計算相應頻率點處H(s)的值
figure(1);
subplot(2,1,1); plot(f, 20*log10(abs(H_s))); % 幅頻特性
axis([0 10000 -40 1]);
xlabel('頻率 Hz');ylabel('幅度 dB');
subplot(2,1,2); plot(f, angle(H_s)); % 相頻特性
xlabel('頻率 Hz');ylabel('相角 rad');
figure(2); freqs(b,a); % 也可用指令freqs直接畫出H(s)的頻率響應曲線。
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -