Date: Feb 14, 2013 3:26 PM Author: Bruno Luong Subject: Re: Can my code be made more efficient using MATLAB's vectorization? "Jeff" wrote in message <email@example.com>...
> P_f = zeros(t_end,N);
> for m=1:t_end
> P_f = W(m,:).^2.*evals;
> P_f = -P_f./N;
Bad: you post an untested code (anyone can spot an obvious mistake), so I do the same:
P_f = bsxfun(@times, W.^2, evals/(-N));