I have this matlab code as part of my matlab project, as the info. i got from the 'profreport' most of the time is spent in the 'while' line. any help regarding how can i improve the efficency. or generally how can i make the for loops more efficient. Thank you!
% p is 2D matrix of big size
s=size(p); pp=p; p=zeros(s(1),s(2));
while(norm(p-pp)>0.05 ) p=pp; for n=1:N z=0; for miu=1:C z = z + p(n,miu) * funQ(n,miu,p,R,N,C); % call function funQ
end for lambda=1:C pp(n,lambda) = (p(n,lambda) * funQ(n,lambda,p,R,N,C))/z; % call function funQ end end end
Best Answer