How to apply the reference target for LQR or LQG controller

13 views (last 30 days)
Hello,
I designed the LQG regulator for the system I want.
The LQG I designed leads to a state that converges to 0.
I would like to change the result so that the controller converges to a separate reference target, but this is where the problem arises.
It is very complicated to explain my system, so in the question I would like to learn how to do it through a simple example.
I wonder how to reflect the reference target through the example provided by the MATLAB site.
The code below is the initialization & setting code of the above UFO controller example.
The system is designed to converge the states with radian and rad/s information to 0, respectively.
I want to change this system so that it finally converges to a non-zero reference state.
How can I design the controller with reference state in this example?
close all
% Initial Conditions
x0 = [3; % 3 radians
0]; % 0 rad/s
% System Dynamics
A = [0 1;
0.01 0];
B = [0;
1];
C = [1 0];
D = 0;
% Control Law
Q = [1 0; % Penalize angular error
0 1]; % Penalize angular rate
R = 1; % Penalize thruster effort
K = lqr(A,B,Q,R);
% Closed loop system
sys = ss((A - B*K), B, C, D);
% Run response to initial condition
t = 0:0.005:30;
[y,t,x] = initial(sys, x0, t);

Accepted Answer

Paul
Paul on 31 Oct 2022
Edited: Paul on 31 Oct 2022
Hi JS,
One common way to track a reference input with a Type 1 system is to use integral control by augmenting the plant with an integrator and applying LQR to the augmented plant.
This function lqi may be of interest, as might this example
  4 Comments
Paul
Paul on 20 Nov 2022
As to the first part, it sounds like you're trying to do something like this:
% Initial Conditions
x0 = [3; % 3 radians
0]; % 0 rad/s
% System Dynamics
A = [0 1;
0.01 0];
B = [0;
1];
% C = [1 0];
C = eye(2); % output both states, the first state is the output to control
D = 0;
sysp = ss(A,B,C,D,'InputName','u','OutputName',{'y' 'x2'});
% Control Law
Q = [1 0; % Penalize angular error
0 1]; % Penalize angular rate
R = 1; % Penalize thruster effort
K = lqr(A,B,Q,R);
% negate the second element of K for negative feedback of x2
% negative feedback on the first state will be achieved via the error signal
K(2) = -K(2);
sysc = ss(K,'OutputName','u','InputName',{'e' 'x2'});
% error signal
s = sumblk('e = r - y');
syscl = connect(sysp,sysc,s,'r','y');
step(syscl)
As to the second part, I'm afraid I can't offer any inputs.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by