⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ar4demo.m

📁 biomedical stuffs...
💻 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.
echo off
disp('The file ar4demo.m may be editted to display intermediate steps')
disp('Type RETURN when ready'); pause
disp(' ')
disp('Generate an AR(4) model and find its frequency response')
disp('impulse response, and power spectrum')
pause(1)
figure(1)
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(5)
plot(w, angle(H));title('Phase of true H(w)');
trueP=abs(H).^2;plot(w,trueP);title('True Power Spectrum');pause(5)
dimpulse(1,a);title('True impulse response');pause(5)
disp(' ')
disp('Generate ten 100-point sample functions of an AR process using this model')
pause(1)
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(1)
% 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)), title('Power spectra of the AR models'); pause(1)
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -