Problem with getting a closed loop Simulink LQR response same as with an m.file

5 views (last 30 days)
Hi there, I've a problem with getting response for my LQR regulator. I attach a file with data, which You should run before running a model for creating a statespace matrixes. I get this error.
I'm trying to get a closed loop response similar to tha last model here: http://ctms.engin.umich.edu/CTMS/index.php?example=AircraftPitch&section=SimulinkModeling
why is this error occuring when my matrixes are for 2 states? When in mdl I change in State Space a value of matrix A from A to A-B*K I get the same response as in mfile.

Answers (1)

Sebastian Castro
Sebastian Castro on 8 Dec 2015
Edited: Sebastian Castro on 8 Dec 2015
Recall that LQR is a full-state feedback approach, but your C matrix is 1-by-2, meaning it only produces one output even though there are 2 states. There is your dimension mismatch.
For this to work, you want your state-space block to return all the states in the system. To do this, your C matrix has to be the identity matrix eye(2) and the D matrix, to match dimensions, should be [0;0]. You can then use this in your feedback loop.
Between the model output and the Scope block, you can add another Gain block with its gain set to your C matrix. Same with the inputs and your D matrix. That'll let you see the right signal on the scope.
I've attached an updated model that matches the figure. Note that I also changed the simulation time and max step size in the solver settings so the output looks smooth.
- Sebastian

Community Treasure Hunt

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

Start Hunting!