How to do autocorrelation with a given data
古いコメントを表示
Hi, Could you help me please? I have data (t,A). t stands for time, A for Absorbance, and i have it in txt file. I'd like to analyze it with autocorrelation function. I tried writing the code, I did just like how i understand what i read the mathworks site 'Autocorr'. But simply saying, i'm afraid the data 't' that i have is not included in the process with my coding. Could I get more explanation, or a validation maybe? thank you.
just for example the data is
t = 3:3:30
A = 3.523;3.523;3.43;3.323;3.43;3.43;3.323;2.923;2.723;2.923;
[t,A]=textread('Data.txt')
[acf,lags]=autocorr(A)
採用された回答
その他の回答 (1 件)
I don't have the Econometric Toolbox so I can't use autocorr but I can use the regular xcorr. Maybe this will help you:
t = 3:3:30;
A = [3.523;3.523;3.43;3.323;3.43;3.43;3.323;2.923;2.723;2.923];
subplot(2, 1, 1);
plot(t, A, 'b-', 'LineWidth', 2);
grid on;
xlabel('t');
ylabel('A')
title('Original Data')
% [t,A]=textread('Data.txt')
% [acf,lags]=autocorr(A)
autoCorrA = xcorr(A);
subplot(2, 1, 2);
plot(autoCorrA, 'b-', 'LineWidth', 2);
grid on;
xlabel('Index');
ylabel('Autocorrelation Value')
title('Autocorrelation Signal')
2 件のコメント
Sasha
2024 年 10 月 28 日
Image Analyst
2024 年 10 月 28 日
I'm not really familiar with the autocorrelation function. It seems different than the usual one we all know. They say
"
The autocorrelation function measures the correlation between the univariate time series yt and yt + k, where k = 0,...,K and yt is a stochastic process.
rk=ckc0,
where
- ck=1TT−k∑t=1(yt−‾y)(yt+k−‾y).
- c0 is the sample variance of the time series.
Suppose that q is the lag beyond which the theoretical ACF is effectively 0. Then, the estimated standard error of the autocorrelation at lag k > q is
SE(rk)=⎹⎷1T(1+2q∑j=1r2j).
If the series is completely random, then the standard error reduces to 1/√T.
"
You probably know more about that function than me. Sorry but I don't really know when you'd use that. I'm guessing it's something special for econometrics applications.
カテゴリ
ヘルプ センター および File Exchange で Correlation and Convolution についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


