Linearize at Simulation Snapshot
This example shows how to use theModel Linearizerto linearize a model by simulating the model and extracting the state and input levels of the system at specified simulation times.
To linearize your model at the command line, use thelinearize
function.
Open the Simulink®model.
sys ='watertank'; open_system(sys)
Open theModel Linearizerfor the model.
In the Simulink model window, in theAppsgallery, clickModel Linearizer.
To specify linearization input and output points, open theLinearizationtab. To do so, in theAppsgallery, click线性化管理.
To specify an analysis point for a signal, click the signal in the model. Then, on theLinearizationtab, in theInsert Analysis Pointsgallery, select the type of analysis point.
Configure the output signal of thePID Controllerblock as anInput Perturbation.
Configure the output signal of theWater-Tank Systemblock as anOpen-loop Output.
Create a new simulation-snapshot operating point at which to linearize the model. In theModel Linearizer, in theOperating Pointdrop-down list, selectTake simulation snapshot.
In the Enter snapshot times to linearize dialog box, in theSimulation Snapshot Timesfield, enter one or more snapshot times at which to linearize. For this example, enter
10
to extract the operating point at this simulation time.Tip
To linearize the model at several operating points, specify a vector of simulation times in theSimulation Snapshot Timesfield. For example, entering
[1 10]
results in an array of two linear models, one linearized att = 1
and the other att = 10
.Generate the simulation-snapshot operating point. ClickTake Snapshots.
The operating point
op_snapshot1
appears in the Linear Analysis Workspace. In theOperating Pointdrop-down list, this operating point is now selected as the operating point to be used for linearization.Linearize the model at the specified operating point and generate a bode plot of the result.
ClickBode. The Bode plot of the linearized plant appears, and the linearized plant
linsys1
appears in the Linear Analysis Workspace.Double click
linsys1
in theLinear Analysis Workspaceto see the state space representation of the linear model. Right-click on the plot and select information from theCharacteristicsmenu to examine characteristics of the linearized response.Close Simulink model.
bdclose(sys);