How do i use LQR control in state space form?

13 views (last 30 days)
I am trying to simulate the step response of the quarter car. for this i am using LQR controller. I have built the state space matrix in the form:
Xdot=AX+BU+GW;
Y = CX+DU;
Here, 'W' is the controller force and 'U' is the excitation displacement from the ground. I gave Matrices A, B, C and D matrices, where D is null matrix and C as unity. The problem is where do I put the matrix 'G' which is GAIN matrix from the controller. until now i have the following:
sys = ss(A,B,C,D);
[K,P] = lqr(A,B,Q,R,N); %where N=0
%we will obtain K and P values
sys = ss(A-B*K,B,C,D);
step(sys)
Theoretically, my G matrix is:
G = [U/m1 0; -U/m2 0];
Where must be the 'G' matrix be inputted?

Answers (3)

Azzi Abdelmalek
Azzi Abdelmalek on 23 Aug 2016
You have first to tell us what are the inputs and outputs of your system. Post the parameters representing your system, and post how did you use the lqr function.
  1 Comment
aniket jakati
aniket jakati on 23 Aug 2016
The following is the code what i have done until now. I am getting the step response but i am sure whether 'G' matrix must be added to 'B' matrix or not. If yes then why?
m1 = 250;
k = 16812;
c = 1000;
m2 = 50;
kt = 190000;
A = [-c/m1 -k/m1 c/m1 k/m1; 1 0 0 0; c/m2 k/m2 -c/m2 -(k+kt)/m2; 0 0 1 0];
G = [0; 0; kt/m2; 0];
B = [1/m1; 0; -1/m2; 0];
C = [0 1 0 0];
D = 0;
sys = ss(A,B+G,C,D);
step(0.1*sys) % Passive suspension step response
hold on
x = 1000;
Q = diag([x 0 0 0]);
R = 0.001;
[K,P] = lqr(A,B+G,Q,R);
sys = ss(A-B*K,B+G,C,D);
t=0:0.05:5;
step(0.1*sys,t) % Active suspension step response
grid on
Also is it necessary here that the 'Q' matrix must be only Q = diag([x 0 0 0]) and not Q = diag([x x x x]) ?
Sorry for the trouble.

Sign in to comment.


Kwin
Kwin on 12 Oct 2016
Both 'W' and 'U' are inputs to your system, however I assume that you will not be able to influence 'U', so it can be considered a disturbance. So 'G' is actually your 'B' matrix. LQR does not consider this disturbance, so you might want to use LQG instead.

duc nguyentrong
duc nguyentrong on 5 Jan 2020
I am researching about active suspension system using LQR in matlab-simulink software to simulate. I have the code of a quarter-car model but I have a problem running. Hope everyone can point out its faults. thanks

Products

Community Treasure Hunt

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

Start Hunting!