Bode Response of Simulink Model
This example shows how to linearize a Simulink® model at the operating point specified in the model using the Model Linearizer.
Open Simulink model.
mdl = 'watertank'; open_system(mdl)
The Water-Tank System block represents the plant in this control system and includes all of the system nonlinearities.
To specify the portion of the model to linearize, first open the Linearization tab. To do so, in the Simulink window, in the Apps gallery, click Linearization Manager.
To specify an analysis point for a signal, click the signal in the model. Then, on the Linearization tab, in the Insert Analysis Points gallery, select the type of analysis point.
Configure the output signal of the PID Controller block as an Input Perturbation.
Configure the output signal of the Water-Tank System block as an Open-loop Output. An open-loop output point is an output measurement followed by a loop opening, which removes the effects of the feedback signal on the linearization without changing the model operating point.
When you add linear analysis points, the software adds markers at their respective locations in the model. For more information on the different types of analysis points, see Specify Portion of Model to Linearize.
For more information on defining analysis points in a Simulink model, see Specify Portion of Model to Linearize in Simulink Model. Alternatively, if you do not want to introduce changes to the Simulink model, you can define analysis points using the Model Linearizer. For more information, see Specify Portion of Model to Linearize in Model Linearizer.
To open the Model Linearizer for the model, in the Simulink model window, in the Apps gallery, click Model Linearizer.
To use the analysis points you defined in the Simulink model as linearization I/Os, on the Linear
Analysis tab, in the Analysis I/Os drop-down
Model I/Os selected.
For this example, use the model operating point for linearization. In the
Operating Point drop-down list, leave
Initial Condition selected.
To linearize the system and generate a response plot for analysis, in the Linearize section, click a response. For this example, to generate a Bode plot for the resulting linear model, click Bode.
The software adds the linearized model,
linsys1, to the
Linear Analysis Workspace and generates a Bode plot for the
linsys1 is the linear model from the specified input to
the specified output, computed at the default model operating point.
For more information on analyzing linear models, see Analyze Results Using Model Linearizer Response Plots.
You can also export the linearized model to the MATLAB® workspace. To do so, in the Data Browser, drag
linsys1 from the Linear Analysis
Workspace to the MATLAB Workspace.