Hello there,
I do not know how to optimize this calculation. It is very slow, since vector "my_vector" is made of 3 millions indeces.
I would like to perform the same calculation using matrices, but I really do not know how to do it!
Thank you!
Have a good one,
Andrea.
corr = zeros(1,n_A*p_A-1); % row vector of 3762799
v = residual(my_vector);variance = mean(v.^2); index_corr = 0;ref_length = 0;for l = 1:(n_A*p_A-1) for j = 1:(n_A*p_A-l) corr(1,l) = corr(1,l)+v(1,j)*v(1,j+l); end corr(1,l) = corr(1,l)/((n_A*p_A-l)*variance); if (corr(1,l) < (1/exp(1))) if index_corr == 0 ref_length = l; end index_corr = 1; end end
Best Answer