Main Content

## Estimate Linear Models from Simulation Results

Learn how to estimate linear models from the results of a dynamic simulation. You can use these techniques for models with discontinuities. For an overview of linearization techniques, including information about simpler methods that you can apply to models without discontinuities, see Linearization Techniques for Control Design. For information about how to prepare models with converter blocks for linearization, see Linearize Models with Converters Using Averaged Switching.

### Linear Analysis of Models with Discontinuities

You can perform linear analysis of Simscape™ models with discontinuities. You can simulate the response of the system to a set of sine wave disturbances and infer a frequency response using Fourier methods.

The Specify Linearization for Model Components Using System Identification (Simulink Control Design) example shows how to use this approach to specify the linearization for a model of a hard drive plant that is driven by a current source. A circuit driven by a pulse-width modulation (PWM) signal implements the current source so that the duty cycle can adjust its output. When you linearize the model from the duty cycle input to the position error, the result is zero. However, you can:

• Estimate the frequency response of the model using the `frestimate` (Simulink Control Design) function.

• Identify a second-order model from the frequency response data using the `tfest` (System Identification Toolbox) function.

• Find a linear approximation of the nonlinear model using the `linearize` (Simulink Control Design) function.

You can use other Simulink® Control Design™ tools to perform frequency response estimation of models with discontinuities. For more information about tools available for linearization, see Choose Linearization Tools (Simulink Control Design).

### Tune Controllers by Running Dynamic Simulation

To design a proportional-integral-derivative (PID) controller you need a linear model of the system from the reference output (voltage or current) to the measured input. However, if your model contains discontinuities, when you use automated linearization, your model linearizes to zero. When a model linearizes to zero, you can use one of these approaches:

• Relinearize the system — Linearize the model at a different operating point or simulation snapshot time.

• Identify a new plant — Use measured or simulated data to identify a plant model.

• Tune the controller from the frequency response — Use simulated data to obtain the frequency response for the plant.

These examples show how to use these last two techniques to tune a PID controller for plants that you cannot linearize: