Specify the portion of the model to linearize by creating an array of analysis points using
the linio 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 linearize 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.
margin(linsys)
Compute Open-Loop Response