How to define the order of states and inputs of a state space model in Model Linearizer

9 views (last 30 days)
Felix Schönig
Felix Schönig on 23 Jun 2021
Commented: Felix Schönig on 24 Jun 2021
I have a model with 69 inputs and one output. For linearization, I mark all input signals that go into the model subsystem via the "Linear analysis points" submenu as "open loop input" (and the output as output obviously) and start the Model Linearizer app. The linearization itself works like a charm and is the preceding step of a model predicitive control development. However, the ORDER (sequence) of neither the states nor the inputs in the resulting state space system (e.g. checked via the property ss.Statename) fits the original order of the inputs.
Simple example:
If I linearize it (obviously an example picture) and then examine the properties of the resulting state space object, the sequence of the inputs, e.g. in ss.InputName, is all wrong, it could like like
and the same is true for internal states. I assume this also affects the state matrices A,B,C,D. However, the original order is important, because it is also done analytically with the symbolic toolbox and the results need to be comparable (and are intertwined later on).
Can somebody help with this? What rules does the sequence follow and how to control it?

Accepted Answer

Paul on 23 Jun 2021
If using the linearize() function, the inputs and outputs will be in the order specified in the io argument. The state ordering can be controlled by the 'StateOrder' Name/Value pair. See
doc linearize
for more details an example of StateOrder.
If using the Model Linearizer App, you can define the desired io vector in your Matlab workspace and copy it into the Linear Analysis Workspace. Or, under the Linear Analysis tab, go to the Model I/Os drop down menu and click Create New Linearization IOs and go through the steps to define an io with the desired order. In the Linear Analysis tab, click More Options and you'll see a State Ordering tab that allows you to rearrange the state order to your needs.
Or you can define the transformation T such that xbar = T*x, where x is the state vector of the linearized model and xbar is the state vector in the desired order. With T use ss2ss() to get the desired state ordering:
doc ss2ss

More Answers (0)

Community Treasure Hunt

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

Start Hunting!