필터 지우기
필터 지우기

How to calculate autocorrelation for each column of matrix?

조회 수: 6 (최근 30일)
Hüsamettin Taysi
Hüsamettin Taysi 2018년 12월 14일
댓글: Hüsamettin Taysi 2018년 12월 14일
Hello, I have 31x14 matrix. And I am trying to calculate autocorrelation lag 1 seperately for each 14 column's. I mean, I want to obtain autocorrelation matrices in 1x14 matrix form.
autocorr(a,'NumLags',1)
With this function, ''The value of 'y' is invalid. Expected input series to be a vector.'' error occured. What should I do to calculate each column's autocorrelation?
Thanks in advance.

답변 (1개)

Image Analyst
Image Analyst 2018년 12월 14일
I don't have your autocorr() function, but I guess it'd go something like this:
data = rand(31, 14) % Create random data for demo.
[rows, columns] = size(data)
for col = 1 : columns
thisColumn = data(:, col);
% Call your custom-written function, autocorr().
someOutput = autocorr(thisColumn, 'NumLags', 1)
% Now do something with someOutput.
end

카테고리

Help CenterFile Exchange에서 Creating and Concatenating Matrices에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by