How to apply input constraint using LQR control in MATLAB
16 views (last 30 days)
Show older comments
Hello,
I have a state space model of a system.I have Got LQR control Gain Matrix "K". And have also been successful
in simulating the system response using MATLAB code but at the end there is something missing.I want to apply input
contraint on the Plant's input.Now, i am stuck like "How do give it?" And "Where to give it" I am attaching my Matlab
Code.The start position of the system is y1 = 450 & y2 = 650 and final reference position is set to (0,0).
I would appreciate your help.
Thank you.
K = [0.0071 -3.4736 * 10 ^ -6 2.2392 -0.0011
3.4736 * 10 ^ -6 0.0071 -0.0011 2.2392];
n = 1.1 * 10 ^ -3;
A = [0 0 1 0;
0 0 0 1;
3. * n ^ 2 0 0 2. * n;
0 0 -2. * N 0];
B = [0 0;
0 0;
Ten;
0 1];
C = [1 0 0 0;
0 1 0 0;
0 0 1 0;
0 0 0 1];
D = [0 0;
0 0;
0 0;
0 0];
Ac = [(AB * K)];
Bc = [B];
Cc = [C];
Dc = [D];
states = {'x1' 'x2' 'x3' 'x4'};
inputs = {'u1' 'u2'};
outputs = {'y1'; 'y2'; 'y3'; 'y4'};
sys = ss (Ac, Bc, Cc, Dc, 'statename', states, 'inputname', inputs, 'outputname', outputs);
t = 0: 0.01: 2000;
u = [0 * t; 0 * t];
[y, t, x] = lsim (sys, u, t, [450,650,0,0]);
[A, h1, h2] = plotyy (t, y (:, 1), t, y (:, 2), 'plot')
set (get (A (1), 'Ylabel'), 'String', 'y1 (Position)')
set (get (A (2), 'Ylabel'), 'String', 'y2 (Position)')
title ('Reference position (0,0) with LQR Control')
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!