Hi People
I trying to optimize the following code and get ride of the for loop. What the code dose, is simple. It estimates the next column in a matrix based on the previous column values times a matrix.
clcclearclose alldt=0.01;t=0:dt:10;sls=zeros(2,numel(t));M_c=[0 1;0 0];M_c=M_c+[1 0;0 1]*1/dt;V_s=[0;1];for i=1:numel(t)-1 sls(:,i+1)=(M_c*sls(:,i)+V_s)*dt;end
Any suggestion for a built-in function that would do the for loop part?
Best Answer