plot autocorrelation

32 Ansichten (letzte 30 Tage)
stefan strasser
stefan strasser am 11 Jun. 2012
Kommentiert: Bill Tubbs am 4 Feb. 2020
Hello guys, might be sort of a beginners question for most of you guys but i am really having trouble tat ploting an autocorrelation function like the example one mentioned in the help section of the function browser "autocorr(econ)"? Any chance somebody could give me a hint on how to plot it alongside with the bounds and label x/y according to the example? many thanks stefan

Akzeptierte Antwort

Wayne King
Wayne King am 11 Jun. 2012
x = randn(1000,1); % 1000 Gaussian deviates ~ N(0,1)
y = filter([1 -1 1],1,x); % Create an MA(2) process
[acf,lags,bounds] = autocorr(y);
stem(lags,acf); xlabel('Lag'); ylabel('\rho(k)');
hold on;
h = line(lags,bounds(1)*ones(length(acf),1));
h1 = line(lags,bounds(2)*ones(length(acf),1));
set(h,'color',[1 0 0]);
set(h1,'color',[1 0 0]);
  3 Kommentare
Kevin Holst
Kevin Holst am 21 Jun. 2012
Make sure you click 'Accept Answer' so the helpers on here know you've got what you needed.
Bill Tubbs
Bill Tubbs am 4 Feb. 2020
Note: 'autocorr' requires Econometrics Toolbox.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Data Distribution Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by