Borrar filtros
Borrar filtros

How to calculate autocorrelation for each column of matrix?

6 visualizaciones (últimos 30 días)
Hüsamettin Taysi
Hüsamettin Taysi el 14 de Dic. de 2018
Comentada: Hüsamettin Taysi el 14 de Dic. de 2018
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.

Respuestas (1)

Image Analyst
Image Analyst el 14 de Dic. de 2018
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

Categorías

Más información sobre Creating and Concatenating Matrices en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by