# SystemModelLinearize

SystemModelLinearize[model]

gives a linearized StateSpaceModel for model at an equilibrium.

SystemModelLinearize[model,op]

linearizes at the operating point op.

# Details and Options   • SystemModelLinearize gives a linear approximation of model near an operating point.
• A linear model is typically used for control design, optimization and frequency analysis.
• A system with equations and output equations is linearized at an operating point and that should satisfy f(0,x0,u0)0.
• • The returned linear StateSpaceModel has state , input and output , with state equations and output equation . The matrices are given by , , , and , all evaluated at , and .
• • SystemModelLinearize[model] is equivalent to SystemModelLinearize[model,"EquilibriumValues"].
• Specifications for op use the following values for the operating point:
•  "InitialValues" initial values from model "EquilibriumValues" FindSystemModelEquilibrium[model] sim or {sim,"StopTime"} final values from SystemModelSimulationData sim {sim,"StartTime"} initial values of sim {sim,time} values at time from sim {{{x1,x10},…},{{u1,u10},…}} state values xi0 and input values ui0
• The simulation sim can be obtained using SystemModelSimulate[model,All,].
• SystemModelLinearize linearizes a system of DAEs symbolically, or first reduces it to a system of ODEs and linearizes the resulting ODEs numerically.
• The following options can be given:
•  Method Automatic methods for linearization algorithm SystemModelProgressReporting Automatic control display of progress
• The option Method has the following possible settings:
•  "NumericDerivative" reduces to ODEs and then linearizes numerically "SymbolicDerivative" linearizes symbolically from a system of DAEs
• Method{"SymbolicDerivative","ReduceIndex"False} turns off index reduction.

# Examples

open allclose all

## Basic Examples(3)

Linearize a DC-motor model around an equilibrium:

Linearize a mixing tank model around equilibrium with given state and input constraints:

Linearize one of the included introductory hierarchical examples:

## Scope(19)

### Model Types(5)

Linearize a textual RLC circuit model:

Linearize an RLC circuit block diagram model:

Linearize an acausal RLC circuit:

Linearize a DAE model:

Linearize a DAE model symbolically:

### Limiting Cases(3)

Linearize a model without inputs:

Linearize a model without states:

Linearize a model without outputs:

### Linearization Values(5)

Linearize around an equilibrium:

Linearize around initial values:

Linearize around equilibrium with given state and input constraints:

Linearize around equilibrium with state constraints:

Linearize around given partial states and inputs, using initial values for remaining values:

### Operating Point(6)

Linearize around an equilibrium:

Linearize around initial values:

Linearize around equilibrium with given state and input constraints:

Linearize around initial values from a simulation:

Linearize around final values from a simulation:

Linearize around final values from a simulation run to steady state: ## Generalizations & Extensions(1)

Hide labels in the resulting StateSpaceModel:

## Options(4)

### Method(4)

The "SymbolicDerivative" method uses a fully specified operating point from a simulation:

The "NumericDerivative" method uses an operating point specified by state and input values:

Linearizing symbolically allows keeping some parameters symbolic:

Use "ReduceIndex" to turn off index reduction when linearizing symbolically:

Turning off index reduction results in a descriptor StateSpaceModel:

## Applications(10)

### Analyzing Linearized System(5)

Compare responses from a model and its linearization at an equilibrium point:

Linearize around the equilibrium point:

Compare the stationary output response with a nonlinear model:

Compare the y1 output:

Test the stability of a linearized system from eigenvalues of the system matrix:

Since there is an eigenvalue with a positive real part, the system is unstable:

Plotting the output response also indicates an unstable system:

Test the stability of a linearized system from poles of the transfer function:

Since there is a pole with a positive real part, the system is unstable:

Do a frequency analysis using a linear model:

By plotting for the linearized transfer function :

Verify the result using Fourier on simulated data:

Compute from :

Alternatively, the imaginary parts of the eigenvalues give the resonance peaks:

Linearization takes place at time 0:

Linearize with the switch connecting at time 0:

If the switch is not connected at time 0, the result is different:

### Controller Design for Linearized System(5)

Design a PID controller using a linearized model:

Define a PID controller and closed-loop transfer function:

Select PID parameters for appropriate step response:

Design a lead-based controller for a DC motor based on its linearization:

Define a PI-lead controller transfer function:

Open-loop transfer function:

Select controller parameters:

Use selected parameters and close the loop with the PI-lead controller:

Design a controller using pole placement:

Place the closed-loop poles:

Compute the closed-loop state-space model:

Show the step response:

Design an LQ controller:

Define state and input weight matrices:

Define LQ controller gain:

Closed-loop state-space model:

Closed-loop step response:

Design a state estimator:

Compute estimator gains and the estimator state-space model:

The state and output response to a unit step on the inputs:

Observer state response:

Compare each state and its estimate:

## Properties & Relations(8)

Linearize around initial values using properties from SystemModel:

Compare results:

Linearize around equilibrium using FindSystemModelEquilibrium:

Compare results:

Compare responses from a model and its linearization at an equilibrium point:

Linearize around the equilibrium point:

Compare the stationary output response with a nonlinear model:

Compare the first output:

Compare responses from a model and its linearization at a non-equilibrium point:

Linearize around the given point:

Compare the stationary output response with a nonlinear model:

Get the output equations:

Compute the stationary output:

Compare the first output:

Use TransferFunctionModel to convert to a transfer function representation:

Use ToDiscreteTimeModel to discretize a linearized model:

Discretize using sample time :

The linearized state-space model is not unique: Change the order in which the variables x1 and x2 are declared: The models are equivalent and have identical transfer functions:

StateSpaceModel can linearize systems of ordinary differential equations:

Using approximate numeric parameter values:

Using SystemModeler to linearize a model of the same system:

## Possible Issues(1)

Some models cannot be linearized symbolically:   Use "NumericDerivative" to linearize numerically: