Correlation funciton to find eigenvalues
Ältere Kommentare anzeigen
Hi I'm trying to do a correlation matrix between 12 matrices in MatLab. I'm using this command:
for j=1:12;
for i=1:12;
for k=1:181;
A(i,j) = A(i,j)+z(k,i)*z(k,j); %which A= matrix elements
end
end
end
but i keep getting this error: Undefined function 'A' for input arguments of type 'double'.
how can I make this work? Thanks
Antworten (2)
the cyclist
am 2 Aug. 2013
Bearbeitet: the cyclist
am 2 Aug. 2013
In the very first line inside all the for loops, you have A(i,j) on the right-hand side of the equation, before you have defined it. MATLAB doesn't know what to do there.
You perhaps need to initialize A:
A = zeros(12,12);
before this code.
Why not using CORR2? If your 12 matrices were stored in a cell array M, you would do something like
n = numel(M) ;
C = zeros(n) ;
for ii = 2 : n
for jj = 1 : ii-1
C(ii,jj) = corr2(M{ii}, M{jj}) ;
end
end
C = C + C.' + eye(n) ;
1 Kommentar
Nicole
am 2 Aug. 2013
Kategorien
Mehr zu Creating and Concatenating Matrices finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!