Iteration of Matrix in equation
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am currently working on Model Predictive Control. In state prediction I have one equation x(k+i)=A*x(k+i-1)+B*u(k+i-1) where x,A,B & u all are matrices. I want to iterate this equation 'n' times. How to iterate equation in case of matrices?
0 Kommentare
Antworten (1)
Babak
am 16 Okt. 2012
Write a for loop and then iterate n times like this:
n=5;
number_of_states=12;
A = ones(12,12);
B = ones(12,1);
x=zeros(12,n);
u=zeros(12,n); 5 you need to know what the control effort vector is for all n
for j=1:n
x(:,j+1) = A*x(:,j)+B*u(:,j)
end
then x(:,end) gives you the final state
0 Kommentare
Siehe auch
Kategorien
Mehr zu Dynamic System Models finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!