Info

此问题已关闭。 请重新打开它进行编辑或回答。

Error : Matrix dimensions must agree

2 次查看(过去 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