Hello,
I have to do a large calculation and the next foor loop takes like 99% of runtime in the script:
for n = 1:iteraciones-1 x(n+1) = a - x(n)^2 + b*y(n); y(n+1) = x(n); end
I've read that if I manage to vectorize it, it will improve my code performance, but im stuck with
x(1) = 1;y(1) = 1;x(2) = a - x(1)^2 + b*x(1);for n = 2:iteraciones-1 x(n+1) = a - x(n)^2 + b*x(n-1);endy(2:iteraciones) = x(1:iteraciones-1);
And I cant think of a way to vectorize that for loop since it uses previous generated values
If someone could take the time to figure this out or link a good resource on how to vectorize, it would be much apreciated
Thanks in advice 🙂
Best Answer