Subscripted assignment dimension mismatch for dare function ( periodic solution for Riccati equation)

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

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.
thank you for your answer ! it works.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 Matrix Computations에 대해 자세히 알아보기

제품

질문:

2020년 5월 5일

댓글:

2020년 5월 7일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by