📄 ardemo.m
字号:
% This program is distributed as a supplement to the book
% "Biomedical Signal Processing and Signal Modeling" by E. N. Bruce,
% published by Wiley, 2000. It is provided for educational use only.
% While every effort has been made to insure its suitability to illustrate
% principles described in the above book, no specific feature or capability
% is implied or guaranteed.
%
% generate an AR(4) model and find its frequency response
% impulse response, and power spectrum
a=[1 -1.978 2.853 -1.877 0.904]
[H,w]=freqz(1,a); plot(w,abs(H));title('Magnitude of true H(w)');pause
plot(w, angle(H));title('Phase of true H(w)');pause
trueP=abs(H).^2;plot(w,trueP);title('True Power Spectrum');pause
dimpulse(1,a);title('True impulse response'); pause
% generate ten 100-point sample functions of an AR process using this model
Hhat=zeros(512,10);th=zeros(10,5);
for k=1:10
wn=randn(1000,1);
x=filter(1,a,wn(901:1000)); idplot([x,wn(901:1000)]);pause
% the 'ar' command with 'ls' and 'now' options invokes the covariance method
thx=ar(detrend(x),4,'ls','now');
present(thx)
th(k,:)=[thx(1,1),thx(3,1:4)];
[numx,denx]=th2tf(thx);
[Hhat(:,k),what]=freqz(numx,denx);
plot(w, abs(H),what,abs(Hhat));pause
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -