Compute Open-Loop Response at the Command Line
This example shows how to compute a linear model of the combined controller-plant system without the effects of the feedback signal. You can analyze the resulting linear model using, for example, a Bode plot.
Open Simulink model.
sys = 'watertank'; open_system(sys)
Specify the portion of the model to linearize by creating an array of analysis points using the docid:slcontrol_ug.bvhjpwl command:
- Open-loop input point at the input of the PID Controller block. This signal originates at the output of the Sum1 block.
- Output measurement at the output of the Water-Tank System block.
io(1) = linio('watertank/Sum1',1,'openinput'); io(2) = linio('watertank/Water-Tank System',1,'output');
The open-loop input analysis point includes a loop opening, which breaks the signal flow and removes the effects of the feedback loop.
Linearize the model at the default model operating point using the docid:slcontrol_ug.bvflwv7 command.
linsys = linearize(sys,io);
linsys is the linearized open-loop transfer function of the system. You can now analyze the response by, for example, plotting its frequency response and viewing the gain and phase margins.
For this system, the gain margin is infinite, and the phase margin is 90 degrees at a crossover frequency of 0.4 rad/s.