
Re: Can my code be made more efficient using MATLAB's vectorization?
Posted:
Feb 14, 2013 3:26 PM


"Jeff" wrote in message <kfj82r$k50$1@newscl01ah.mathworks.com>...
> > P_f = zeros(t_end,N); > for m=1:t_end > P_f = W(m,:).^2.*evals; > end > 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));
% Bruno

