www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/EstimateTheParametersOfAnARModelExample.m

    %% Estimate the parameters of an AR model
%%
% *Note*: This example runs only in R2016b or later. If you are using an
% earlier release, replace each call to the function with the equivalent
% |step| syntax. For example, myObject(x) becomes step(myObject,x).

%%
% Use the |dsp.BurgAREstimator| System object(TM) to estimate the parameters
% of an AR model.
rng default; % Use default random number generator and seed
noise = randn(100,1); % Normalized white Gaussian noise
x = filter(1,[1 1/2 1/3 1/4 1/5],noise);
hburgarest = dsp.BurgAREstimator(...
    'EstimationOrderSource', 'Property', ...
    'EstimationOrder', 4);
[a, g] = hburgarest(x);
x_est = filter(g, a, x);
plot(1:100,[x x_est]);
title('Original and estimated signals');
legend('Original', 'Estimated');