Autocorrelation with big data

조회 수: 2 (최근 30일)
Abdur Rob
Abdur Rob 2021년 6월 12일
댓글: Sulaymon Eshkabilov 2021년 6월 12일
I have written this code to find autocorrlation
temp = xlsread('temp.xlsx');
tempnorm = temp - mean(temp);
fs = 2*24; % 2 times per hours
t = (0:length(tempnorm)-1)/fs;
plot(t, tempnorm); xlabel 'Time in days'; ylabel 'Temp'; axis tight
[autocor, lags] = xcorr(tempnorm, 3*7*fs, 'coeff');
plot(lags/fs, autocorr);
when i try to run this it shows
Index exceeds the number of
array elements (0).
Error in autocorr (line 143)
y = args{1};
please help me to figure it out

채택된 답변

Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 6월 12일
One typo that caused the error:
plot(lags/fs, autocor); % autocor is the variable name NOT autocorr
  댓글 수: 2
Abdur Rob
Abdur Rob 2021년 6월 12일
thank you
Sulaymon Eshkabilov
Sulaymon Eshkabilov 2021년 6월 12일
Most welcome!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by