Filter löschen
Filter löschen

How to use sostools to find S matrix in ARE

2 Ansichten (letzte 30 Tage)
Ivan Dwi Putra
Ivan Dwi Putra am 28 Sep. 2020
Kommentiert: Ivan Dwi Putra am 1 Okt. 2020
This is the parameter
clear; close; clc;
syms a1_head a2_head b hstar
%Parameter Massa
m1 = 8095; % massa train set 1 dalam kg
m2 = 8500; % massa train set 2 dalam kg
g = 10;
c_0_1 = 0.01176;
c_1_1 = 0.00077616;
c_2_1 = 4.48 ;
c_0_2 = 0.01176 ;
c_1_2 = 0.00077616;
c_2_2 = 4.48;
v_0 = 300;
hstar = 120;
a_1 = -1./m1.*(c_1_1 + 2.*c_2_1.*v_0);
a_2 = -1./m2.*(c_1_2 + 2.*c_2_2.*v_0);
a_1_head = 1-(a_1.*hstar);
a_2_head = 1-(a_2.*hstar);
b = 1;
This is the model
% Model data
A = sym(zeros(4,4));
A(1,2) = a_1_head;
A(3,2) = (a_2_head) - 1; A(3,4) = a_2_head;
display(A);
B = sym(zeros(4,2));
B(1,1) = -b*hstar;
B(2,1) = b;
B(3,2) = -b*hstar ;
B(4,1) = -b; B(4,2) = b;
display(B);
This is the Q and R matrix for LQR
% Q and R matrices for ARE
Q = [10 0 0 0;
0 10 0 0;
0 0 10 0;
0 0 0 10;
];
R = sym(zeros(2,2)); R(1,:) = [1 0]; R(2,:) = [0 1]; display(R);
This is the S matrix that I want to find the value
% Matrix S to find
svar = sym('s',[1 16]);
S = [svar(1:4); svar(5:8); svar(9:12); svar(13:16)];
S(2,1) = svar(2);
S(3,1) = svar(3);
S(3,2) = svar(7);
S(4,1) = svar(4);
S(4,2) = svar(8);
S(4,3) = svar(12);
display(S);
This is the Algebra Ricatti Equation (ARE) in LQR Control
% LHS of ARE: A'*S + S*A' - S*B*Rinv*B'*S
left_ARE = transpose(A)*S + S*A - S*B*inv(R)*transpose(B)*S;
display(left_ARE);
% RHS of ARE: -Q
right_ARE = -Q;
display(right_ARE);
I want to use sostools and sedumi to find S semidifinite matrix
syms s1 s2 s3 s4 s6 s7 s8 s11 s12 s16
[Sol_s] = sosgetsol(left_ARE,right_ARE,sedumi)
disp(Sol_s)
But why there is error like this
Error using sedumi (line 232)
Should have at least (A,b) or (A,c) arguments
Error in Algebraricattieqvpa (line 75)
[Sol_s] = sosgetsol(left_ARE == right_ARE,sedumi)
my left_ARE is A*x
my right_ARE is B
but why can't get the answer?
  12 Kommentare
Walter Roberson
Walter Roberson am 30 Sep. 2020
I do not know at the moment.
The difficulty I am having installing sedumi is probably related to my using MacOS.
Ivan Dwi Putra
Ivan Dwi Putra am 1 Okt. 2020
ok thank you

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Produkte


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by