I’m trying to generate an AR(2) process with MATLAB’s filter() function, as shown here:
A=[1 -2.7607 3.8106 -2.6535 0.9238];
% AR(4) coefficients
y=filter(1,A,0.2*randn(1024,1));
% Filter a white noise input to create AR(4) process
[ar_coeffs,nv] =arburg(y,4);
%compare the results in ar_coeffs to the vector A.
I have a time series data set and would like to approximately match the ‘total’ variance of the data in a simulated data set. When I use nv in place of 0.2 in the second line of code, I get a variance in the simulated that is much too small.
Can anyone help me rectify this situation to generate a look-alike simulated AR(N) data set?
Thanks,
Mark
If you look at
nvin this example it is 0.0392, this is variance. To create a white noise with variance a^2 you need to multiply that sequence by a. If a^2 = 0.392 then a is 0.198 (very close to 0.2). So Colin T is right and you need to multiply your randn(1024,1) bysqrt(nv)not bynv.