|
From: | Jaroslav Hajek |
Subject: | Re: Matrix loop |
Date: | Thu, 6 May 2010 06:54:27 +0200 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |