Hello. I've got a problem that my loop doesn't execute fast enough, even though it is simple moving average. Is there any smart way to make it work faster? x is a huge array, and there is some indexing using : in every iteration, that's probably the reason.
len = length(x); % around 6000000
A = 1/200;for n = 100+1:len-100 MA = A*sum(x(n - 100: n + 100)); % Do something with MA. However I know that the above part is the slow one
end
I was trying to find some information about vectorization, but I can't see how could I apply these methods.
Best Answer