Subscripted assignment dimension mismatch for dare function ( periodic solution for Riccati equation)
2 次查看(过去 30 天)
显示 更早的评论
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 个评论
Rik
2020-5-7
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.
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Matrix Computations 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!