Info

This question is closed. Reopen it to edit or answer.

Error : Matrix dimensions must agree

1 view (last 30 days)
Ahmad Sheikh
Ahmad Sheikh on 24 Oct 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
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?

Answers (1)

dpb
dpb on 24 Oct 2015
(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 Comments
Ahmad Sheikh
Ahmad Sheikh on 24 Oct 2015
Edited: Ahmad Sheikh on 24 Oct 2015
well
P=lmivar (1,[12 1])
it doesnt show that P is a 12x1 matrix.
dpb
dpb on 24 Oct 2015
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?

This question is closed.

Community Treasure Hunt

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

Start Hunting!