| Using Simulink | Search  Help Desk |
Linearization
Simulink provides thelinmod and dlinmod functions to extract linear models in the form of the state-space matrices A, B, C, and D. State-space matrices describe the linear input-output relationship as
lmod.
[A,B,C,D] = linmod('lmod')
A =
-2 -1 -1
1 0 0
0 1 -1
B =
1
0
0
C =
0 1 0
0 0 -1
D =
0
1
Inputs and outputs must be defined using Inport and Outport blocks from the Signals & Systems library. Source and sink blocks do not act as inputs and outputs. Inport blocks can be used in conjunction with source blocks using a Sum block. Once the data is in the state-space form or converted to an LTI object, you can apply functions in the Control System Toolbox for further analysis:
sys = ss(A,B,C,D);
bode(A,B,C,D) or bode(sys)
step(A,B,C,D) or step(sys) impulse(A,B,C,D) or impulse(sys) lsim(A,B,C,D,u,t) or lsim(sys,u,t)Other functions in the Control System Toolbox and Robust Control Toolbox can be used for linear control system design. When the model is nonlinear, an operating point may be chosen at which to extract the linearized model. The nonlinear model is also sensitive to the perturbation sizes at which the model is extracted. These must be selected to balance the trade-off between truncation and roundoff error. Extra arguments to
linmod specify the operating point and perturbation points:
[A,B,C,D] = linmod('sys', x, u, pert, xpert, upert)
For discrete systems or mixed continuous and discrete systems, use the function dlinmod for linearization. This has the same calling syntax as linmod except that the second right-hand argument must contain a sample time at which to perform the linearization. For more information, see linfun.
Using linmod to linearize a model that contains Derivative or Transport Delay blocks can be troublesome. Before linearizing, replace these blocks with specially designed blocks that avoid the problems. These blocks are in the Simulink Extras library in the Linearization sublibrary. You access the Extras library by opening the Blocksets & Toolboxes icon.
