Chapter 6 State-Space Design
© National Instruments Corporation 6-23 Xmath Control Design Module
lqgcomp( )SysC = lqgcomp(Sys,Kr,Ke,{direct})
The lqgcomp( ) function creates a dynamic compensator given a
dynamic system having at least one state and the regulator and estimator
gain matrices. The returned compensator SysC is always in state-space
form.
The regulator and estimator gains Kr and Ke need to have been calculated
prior to the call to lqgcomp( ). You can use regulator( ) and
estimator( ) to compute these gains if they are not already available.
These functions give you the option to incorporate the presence of the white
process and measurement noises ω and ν in your model, as shown in
Figure 6-6.
Example 6-7 uses the inverted pendulum problem estimator and regulator
gain vectors (obtained in the preceding two examples) to form a
compensator. Notice that for this example you use the optional fields of the
system( ) function to store information that will be useful when you
combine and simulate the compensator-plant system.
Example 6-7 Combining the Regulator and Estimator into a Full Compensator
A = [0,1,0,0; 21,0,0,0.8; 0,0,0,1; 0,0,0,–4];
B = [0,–2,0,1]';
C = [1,0,0,0;0,0,1,0];
D = [0;0];
ipsys = system(A,B,C,D, {inputNames = "Force (u)",
outputNames = ["phi","x"],
stateNames = ["phi","d(phi)","x","d(x)"]});
Kr=regulator(ipsys,diagonal([1,0,.1,0]),1e-5);
Ke=estimator(ipsys,0.25*B*B',
diagonal([1e-6,3e-6]));
ipsysc=lqgcomp(ipsys,Kr,Ke);
Now that you have the compensator, you need to connect it to the original
plant:
ipsyscl = afeedback(ipsys, ipsysc);
The system now has eight states (four from the compensator, four from the
original plant), three individual inputs (u and y, where y comprises φ and x)
and three outputs (again, u and y). Here you have not added additional
inputs to the system for process and measurement noise. Now you can