Hi,
I'm runing a simple Monte Carlo loop, using the exact same code, in Matlab R2008b and it takes 29 seconds to do 30,000 iterations, while the same thing in Matlab R2012 a takes 26 minutes.
There is nothing fancy in the loop, I just generate a multivariate randome number and then do the monte carlo simulations (see code below). My code calls a function (psimat) that just reorganizes the data. I just can't understand the huge difference in performance, and it's not the PC, I'm running both on a server.
Any ideas?
Thank you,
Sebastian
for num = 1:monte; % 'monte' times of iterations
smpi_rnd = mvnrnd(smpi,kron(omega,iQ)/nobs); %Multivar. N random number
pi_rnd = reshape(smpi_rnd,K*p+dis*(q+1),K); psi_rnd = psimat(p,q,K,dis,st,pi_rnd); % Store mean responses
for i = 1:dis for j = 1:st+1 mr_rnd(j+(i-1)*(st+1),num) = psi_rnd(K*j,i); end; end; % Store cumulative effects
for i = 1:dis ce(i,num) = sum(mr_rnd(1+(i-1)*(st+1):4+(i-1)*(st+1),num)); end; end; % End of Monte Carlo loop
Best Answer