Subscripted assignment dimension mismatch for dare function ( periodic solution for Riccati equation)
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi everyone,
Any help on this will be highly appreciated
I have a dynamic system, which I linearized according to different periods. I seek from this system in the form:
xdot (t) = A (t) x + B (t) u
y (t) = C (t) x
to solve the Riccati equation. In the case of a periodic system, I end up with multidimensional matrices. When trying to solve the riccati equation with a "loop for" on the dare function I get the following error: Subscripted assignment dimension mismatch.
A_p(4,4,36)
B_p(4,3,36)
C_p(2,4,36)
R_ipb(3,3,36)
A_p=AMat;
B_p=BMat;
C_p=CMat;
[m,n,p]=size(AMat);
[mb,nb,pb]=size(BMat);
R_ipb = zeros(nb,nb,pb);
for i=1:p
Q_ipb(:,:,i)=CMat(:,:,i)'*CMat(:,:,i);
end
for i=1:pb
R_ipb(:,:,i)=eye(nb);
end
%periodique riccati résolution à chaque pas azimutal
for i=1:p
[X(:,:,i),K_ipb(:,:,i)]=dare(A_p(:,:,i),B_p(:,:,i),Q_ipb(:,:,i), R_ipb(:,:,i));
end
I have looked at the documentation about the dare function on mathworks but I don't understand my problem.
Thank you in advance for your answers.
2 comentarios
Rik
el 7 de Mayo de 2020
Your output syntax assumes all iterations will result in the same size 2D array. It also assumes you don't have variables with that name, or that they are pre-allocated with the correct size.
Respuestas (0)
Ver también
Categorías
Más información sobre Matrix Computations en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!