fig7-38.m
来自「数字信号处理(机械工业出版社)的源码」· M 代码 · 共 20 行
M
20 行
%fig7-38
f = [0 .4 .4 .6 .6 1];
H = [0 0 1 1 0 0];
fs = 1000; % assumed sampling rate
N = 8; % Order of the filter (number of poles and zeros).
[Bh,Ah] = yulewalk(N,f,H); % Working, please wait.....
n = 256;
hh = freqz(Bh,Ah,n); % compute complex frequency response
hy = abs(hh); % compute magnitude
ff = fs/(2*n) * (0:n-1);
N = 4; passband = [.4 .6]; ripple = .1;
[Bb,Ab] = butter(N, passband);
[Bc,Ac] = cheby1(N, ripple, passband);
h = [abs(hh) abs(freqz(Bb,Ab,n)) abs(freqz(Bc,Ac,n))];
plot(ff(2:n),20*log10(h(2:n,:)))
legend({'YuleWalk','Butterworth','Chebyshev'});
title('YuleWalk, Butterworth and Chebyshev filters')
xlabel('Frequency (Hz)')
ylabel('Magnitude in dB')
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?