MATLAB: How to remove unwanted states from a linearized Simulink dynamic model

Simulink Control Design

I have a non-linear Simulink model of a dynamic system. When I linearize the model using the function "linearize" at an operating point (trim), I get a state space system with 30 states. That is expected because my model indeed has 30 states. But not all these states have significant dynamic effects on the linearized model, my use case, and the input/output (I/O) of the system. What is the best way to remove the unwanted states from my state space model and reduce it to the necessary 12 states that are significant for my system dynamics?

Best Answer

For the following use case, the "linearize" function generates a 30 dimensional state space model stored in an object, for example, called 'linsys'. 'linsys' stores a 30x1 vector of states. If you do not know the exact rows that correspond to the unwanted states in the state vector, you can execute the function "balreal" to perform a Gramian-based input/output balancing of state-space realizations in order to identify which states have negligible effect on the input and output. It returns the corresponding vector row index for the negligible states. Then, you can use the function "modred" to eliminate the states that do not affect the system I/O.
An example of how to achieve the above workflow can be found in the link below:
The documentation for the functions "linearize", "balreal", and "modred" can be found below respectively: