MATLAB Examples

LQG Controller Tuning

This example shows how to use Simulink® Design Optimization™ to optimize the output response of a plant by tuning the LQR gain matrix and feed-forward gain. This model includes uncertainty in the plant model and accounts for this uncertainty in the optimization process.

Open the lqg_demo model using the command below and run the simulation. The simulation produces an unoptimized response of the plant and the initial data for optimization. Double-click the Scope block to view the unoptimized response of the plant.


Double-click the Plant/Actuator block to view the details of the subsystem. Note that the plant is represented in State-Space form in this model and includes Rate Limiter and Saturation blocks.

Double-click the Output Constraint block to view constraints on the step response of the plant.

You can launch Response Optimization Tool using the Analysis menu in Simulink, or the sdotool command in MATLAB. You can launch a pre-configured optimization task in Response Optimization Tool by first opening the model and by double-clicking on the orange block at the bottom of the model. From the Response Optimization Tool, press the Plot Model Response button to simulate the model and show how well the initial design satisfies the design requirements.

The solid line in the plot indicates the plant response without considering the uncertainties and the dashed lines indicate the uncertain responses.

We start the optimization by pressing the Optimize button from the Response Optimization Tool. The plots are updated to indicate that the design requirements are now satisfied.

% Close the model