Estimate spectrum from AR process
8 views (last 30 days)
Show older comments
Hi, I'am going to estimate the spectrum using AR. I have writen this code:
clc, clear all, close all;
N = 10; % length of test input signal
x = 1:N; % test input signal (integer ramp)
a = [1, 0, 1, 0, 0.5]; % transfer function numerator
Y = filter(1, a, x);
th_burg = ar(Y, 4, 'burg', 'Ts', 2000);
th_fb = ar(Y, 4, 'fb', 'Ts', 2000);
th_gl = ar(Y, 4, 'gl', 'Ts', 2000);
th_ls = ar(Y, 4, 'ls', 'Ts', 2000);
th_yw = ar(Y, 4, 'yw', 'Ts', 2000);
Now I must compare the estimated spectrum with the true spectrum for the different model orders, but I dont know how. And what is the true spectrum?
Also I have to compare the results form above with the results I get using FFT. And here is the problem I also dont know to do this.
I hope that someone are able to help me.
0 Comments
Accepted Answer
Rajiv Singh
on 14 Mar 2011
Your theoretical transfer function is G(z) = 1/(1 + z^-2 + 0.5*z^-4). The frequency response is the value of this function for z = exp(j*w*Ts). Ts=2000. w is the frequency for which you want to calculate the spectrum (say, linspace(0, pi/Ts, 1000))
To compute the spectra of time series models th_fb etc, use freqresp or bode command. However, note that AR expects to model a stationary time series (or an impulse response in deterministic case). So I would apply AR to diff(diff(Y)) to get the various models; you might need to set the noisevariance to 1 after estimation for comparison purposes.
Result using FFT: |G(w)| = fft(Y)./|fft(x)| This will not not good luck for a variety of reasons, in addition to the non-periodic nature of your input signal.
0 Comments
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!