help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Matrix loop


From: Riccardo Corradini
Subject: Matrix loop
Date: Wed, 5 May 2010 16:27:52 +0000 (GMT)

Hi,
I would know if is there a more efficient way to perform the following operation
s_cR =21;
n=1000;
a= rand(s_cR,s_cR,n);
whos a
meant = mean(a,3);
whos meant
for tt=1:n
    b(:,:,tt) = a(:,:,tt) - meant;
    c(:,:,tt)= b(:,:,tt) * b(:,:,tt)';
endfor
result = sum(c,3)*1/n;
whos result

Thanks in advance



reply via email to

[Prev in Thread] Current Thread [Next in Thread]