Documentation Center

  • Trial Software
  • Product Updates


Extract continuous-time linear state-space model around operating point


argout = linmod2('sys', x, u);
argout = linmod2('sys', x, u, para);



Name of the Simulink® system from which the linear model is extracted.

x, u

State (x) and the input (u) vectors. If specified, they set the operating point at which the linear model is extracted. When a model has model references using the Model block, you must use the Simulink structure format to specify x. To extract the x structure from the model, use the following command:

x = Simulink.BlockDiagram.getInitialState('sys');

You can then change the operating point values within this structure by editing x.signals.values.

If the state contains different data types (for example, 'double' and 'uint8'), then you cannot use a vector to specify this state. You must use a structure instead. In addition, you can only specify the state as a vector if the state data type is 'double'.


A three-element vector of optional arguments:

  • para(1) — Perturbation value of delta, the value used to perform the perturbation of the states and the inputs of the model. This is valid for linearizations using the 'v5' flag. The default value is 1e-05.

  • para(2) — Linearization time. For blocks that are functions of time, you can set this parameter with a nonnegative value that gives the time (t) at which Simulink evaluates the blocks when linearizing a model. The default value is 0.

  • para(3) — Set para(3)=1 to remove extra states associated with blocks that have no path from input to output. The default value is 0.


linmod, dlinmod, and linmod2 return state-space representations if you specify the output (left-hand) side of the equation as follows:

  • [A,B,C,D] = linmod('sys', x, u) obtains the linearized model of sys around an operating point with the specified state variables x and the input u. If you omit x and u, the default values are zero.

linmod and dlinmod both also return a transfer function and MATLAB® data structure representations of the linearized system, depending on how you specify the output (left-hand) side of the equation. Using linmod as an example:
  • [num, den] = linmod('sys', x, u) returns the linearized model in transfer function form.

  • sys_struc = linmod('sys', x, u) returns a structure that contains the linearized model, including state names, input and output names, and information about the operating point.


linmod2 computes a linear state-space model by perturbing the model inputs and model states, and uses an advanced algorithm to reduce truncation error.

linmod2 obtains linear models from systems of ordinary differential equations described as Simulink models. Inputs and outputs are denoted in Simulink block diagrams using Inport and Outport blocks.


By default, the system time is set to zero. For systems that are dependent on time, you can set the variable para to a two-element vector, where the second element is used to set the value of t at which to obtain the linear model.

The ordering of the states from the nonlinear model to the linear model is maintained. For Simulink systems, a string variable that contains the block name associated with each state can be obtained using

[sizes,x0,xstring] = sys

where xstring is a vector of strings whose ith row is the block name associated with the ith state. Inputs and outputs are numbered sequentially on the diagram.

For single-input multi-output systems, you can convert to transfer function form using the routine ss2tf or to zero-pole form using ss2zp. You can also convert the linearized models to LTI objects using ss. This function produces an LTI object in state-space form that can be further converted to transfer function or zero-pole-gain form using tf or zpk.

The default algorithms in linmod and dlinmod handle Transport Delay blocks by replacing the linearization of the blocks with a Pade approximation. For more information, see Linearizing Models.

See Also

| |

Was this topic helpful?