Update dynamic system data in a response plot
the dynamic system used to compute a response plot with the dynamic
system model or model array
sys, and updates
the plot. If the plot with handle
more than one system response, this syntax replaces the first response
in the plot.
updateSystem is useful, for example,
to cause a plot in a GUI to update in response to interactive input.
See Build GUI With Interactive Plot Updates.
Replace plotted step response data with data computed from a different dynamic system model.
Suppose you have a plant model and pure integrator controller that you designed for that plant. Plot the step responses of the plant and the closed-loop system.
w = 2; zeta = 0.5; G = tf(w^2,[1,2*zeta*w,w^2]); C1 = pid(0,0.621); CL1 = feedback(G*C1,1); h = stepplot(G,CL1);
h is the plot handle that identifies the plot created by
stepplot. In this figure,
G is used to compute the first response, and
CL1 is used to compute the second response. This ordering corresponds to the order of inputs to
Suppose you also have a PID controller design that you want to analyze. Create a model of the closed-loop system using this alternate controller.
C2 = pid(2,2.6,0.4,0.002); CL2 = feedback(G*C2,1);
Update the step plot to display the second closed-loop system instead of the first. The closed-loop system is the second response in the plot, so specify the index value 2.
updateSystem command replaces the system used to compute the second response displayed in the plot. Instead of displaying response data derived from
CL1, the plot now shows data derived from
h— Plot to updateplot handle
Plot to update with new system data, specified as a plot handle.
Typically, you obtain the plot handle as an output argument of a response
plotting command such as
For example, the command
h = bodeplot(G) returns
a handle to a plot containing the Bode response of a dynamic system,
sys— System for new response datadynamic system model | model array
System from which to compute new response data for the response plot, specified as a dynamic system model or model array.
sys must match the plotted system that
it replaces in both I/O dimensions and array dimensions. For example,
h refers to a plot that displays the
step responses of a 5-element vector of 2-input, 2-output systems.
In this case,
sys must also be a 5-element vector
of 2-input, 2-output systems. The number of states in the elements
sys need not match the number of states in
the plotted systems.
N— Index of system to replace1 (default) | positive integer
Index of system to replace in the plot, specified as a positive integer. For example, suppose you create a plot using the following command.
h = impulseplot(G1,G2,G3,G4);
To replace the impulse data of
G3 with data
from a new system,
sys, use the following command.