Filter löschen
Filter löschen

How does MATLAB choose states when linearizing a model (e.g. with linmod)?

15 Ansichten (letzte 30 Tage)
Timo Briem
Timo Briem am 26 Nov. 2021
Beantwortet: Neelanshu am 19 Apr. 2024
I would like to understand how MATLAB chooses the states when I call:
state_space_plant_struc = linmod(mdl,0,0,[1e-5, 0, 1]);
The choice seems to be pretty random. Sometimes I get states called "mdl/SolverConfiguration/EVAL_KEY/INPUT_1_1_1" (especially if I try to linearize partly nonlinear models). Are these virtual states or what do they mean ?
Is there any possibility to choose the states of the generated linearized model by oneself? If so, could you please show/tell me how to do that ?
Thx for your help :)

Antworten (1)

Neelanshu am 19 Apr. 2024
Hi Timo,
Simulink linearizes each block separately and combines the resulting individual linear models to get a full linearized model. Many of the nonlinear blocks within Simulink are assigned a Jacobian; it’s hidden within the metadata of the block. So Simulink uses that to determine the linear model. Once all of the blocks are linearized, they are combined into one single state space representation.
In case the block doesn’t have a Jacobian assigned to it, Simulink approximates the Jacobian by slightly perturbing the block input and any internal state and measuring the output. To visualize this for the square root function operating around 4, imagine sending through 4.01 and 3.99 and then using the results to calculate a slope. This is a numerical approximation of the Jacobian.
If you don’t want to rely on the numerical approximation of the Jacobian, there is a third way that Simulink can handle nonlinear blocks. You can decide how you want a nonlinear block to linearize, then assign that linearization to the block, by following the steps mentioned below :
  • You do this by right clicking the block you want to linearize and selecting "linear analysis" option
  • Select "Specify selected block linearization" option
  • Specify the state space model for the block for its linearization
So you can use this method to enforce exactly the linearization you want in cases where numerical perturbation might not produce the result you’re looking for. You may refer to the following webinar on Lineraizing Simulink Models to learn more about how Simulink performs linearization :
Hope this helps.


Mehr zu Trimming and Linearization finden Sie in Help Center und File Exchange




Community Treasure Hunt

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

Start Hunting!

Translated by