MATLAB: How to make the settling time or rise time automatically display when using the STEP function from the Control Systems Toolbox

automateautomaticallyControl System Toolboxdisplaypeakplotresponseriseselectionsettlingstatesteadysteptime

When I use the STEP function to plot the step response of an LTI system, I would like the settling time to display automatically without having to select it from the UIcontextmenu.

Best Answer

The Control Systems Toolbox does not explicitly offer this functionality. However, you can manipulate some handle properties to obtain this result. Once the STEP function has been used to create the time response plot, first obtain the handle for the "Settling Time" UIcontextmenu option using the FINDALL function. This can be done in the following manner:
h4 = findall(gcf,'Label','Settling Time');
Once you have the handle for the "Settling Time" UIcontextmenu option, evaluate the callback associated with the handle. This callback displays the settling time on the plot, and is executed whenever the user left-clicks on the "Settling Time" option in the menu. To obtain the callback property of the "Settling Time" UIcontextmenu option, use the GET function:
A=get(h4,'Callback');
The contents of the "Callback" property includes the callback function handle and the input arguments to the function:
A =
[@localCallback ]
[1x1 resppack.timeplot]
'Settling Time'
'resppack.StepSettleTimeData'
'resppack.SettleTimeView'
To have this callback executed automatically, the FEVAL function is used in the following manner:
feval(A{1},h4,[],A{2:5});
Note that the FEVAL command accepts the callback function handle and input arguments. The first 2 arguments to callback functions are always the same in MATLAB 6.5 (R13). The first argument is the handle to the object that has its callback executing. The second argument is called eventdata, and it is always empty in MATLAB 6.5 (R13).
Note that the instructions above only show you the settling time of your system on the graph. If you would like to programatically calcuate the settling time of your system, see the Related Solution below.