Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Error : Matrix dimensions must agree

1 回表示 (過去 30 日間)
Ahmad Sheikh
Ahmad Sheikh 2015 年 10 月 24 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I have written the follwing LMI in matlab
(A1-B*F1)' * P * (A1-B*F1) - P < 0
where, A1 is a 12 x 12 matrix B is a 12 x 4 matrix and F1 is a 4 x 12 matrix
A1=[0 0 0 0 0 0 1 0 0 0 0 0;0 0 0 0 0 0 0 1 0 0 0 0;0 0 0 0 0 0 0 0 1 0 0 0;0 0 0 0 0 0 0 0 0 0 0 1;0 0 0 0 0 0 0 0 0 0 1 0;0 0 0 0 0 0 0 0 0 1 0 0;0 0 0 0 -9.4757 2.539 0 0 0 0 0 0;0 0 0 0 2.539 9.4757 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0;0 0 0 0 0 0 0 0 0 0 0 0];
B=[0 0 0 0;0 0 0 0;0 0 0 0;0 0 0 0;0 0 0 0;0 0 0 0;0 0 0 0;0 0 0 0;-1.4286 0 0 0;0 0.24162 0 0;0 0 0.24162 0;0 0 0 0.80541];
setlmis([]);
P=lmivar(1,[12 1]);
F1=lmivar(2,[4 12]);
lmiterm([1 1 1 P],(A1-B*F1)',(A1-B*F1));
lmiterm([1 1 1 P],1,-1);lmis=getlmis;
[tmin,xfeas]=feasp(lmis);
f1=dec2mat(lmis,xfeas,F1)
but its giving an error '' Matrix dimensions must agree '' can some one help why?

回答 (1 件)

dpb
dpb 2015 年 10 月 24 日
(A1-B*F1)' * P * (A1-B*F1) - P < 0
where, A1 is a 12 x 12 matrix B is a 12 x 4 matrix and F1 is a 4 x 12 matrix
(A1-B*F1)' * P * (A1-B*F1)
[12x12] * [12 1] --> [12x1] * [12x12]
BOOM! You're trying to multiply a column vector on the left of the square array...
  2 件のコメント
Ahmad Sheikh
Ahmad Sheikh 2015 年 10 月 24 日
編集済み: Ahmad Sheikh 2015 年 10 月 24 日
well
P=lmivar (1,[12 1])
it doesnt show that P is a 12x1 matrix.
dpb
dpb 2015 年 10 月 24 日
Oh, yeah? Syntax surely looks like it would be....so what is it?
But whatever, work thru the expression as shown; bound to find somewhere it breaks down -- maybe there's a problem in association/precedence in computer evaluation from what is intended mathematically?

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by