MATLAB: For Loop with matrices

forfor loophelploopmatrixmatrix manipulation

Hello!
I have these matrices:
x(0)=[1;2] and x(1)=A*x(0), where A=[1 3;4 5]
How can I create a for lopp to obtain:
x(2)=A*x(1)
x(3)=A*x(2)
....
Thanks for your answers!!!!

Best Answer

One approach:
A=[1 3;4 5];
x(:,1)=[1;2];
N = 10;
for k = 1:N
x(:,k+1) = A*x(:,k);
end
You simply need to be careful to provide the correct indexing.
Experiment to get the result you want.