Main Content

updateSystem

(Not recommended) Update dynamic system data in a response plot

updateSystem is not recommended. Update the model in linear analysis plots by modifying the chart object properties using dot notation. For more information, see Version History.

Description

updateSystem(rp,sys) replaces 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 contains 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 UI to update in response to interactive input.

updateSystem(rp,sys,N) replaces the data used to compute the Nth response in the plot.

example

Examples

collapse all

Replace step response data in an existing plot 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 stepplot.

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(h,CL2,2);

The 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 CL2.

Input Arguments

collapse all

Response plot chart object, specified as one of the following objects:

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, suppose rp 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 of sys need not match the number of states in the plotted systems.

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.

updateSystem(h,sys,3);

Alternative Functionality

You can also update the dynamic system in a response plot using dot notation. For example, the following commands remove the feedthrough component of a plotted state-space model by setting the D matrix to zero.

myPlot.Responses(1).SourceData.Model.D = 0;

Version History

Introduced in R2013b

collapse all

R2024b: Not recommended

updateSystem is not recommended. Update the model in linear analysis plots by modifying the chart object properties using dot notation.

To change the model for a response plot with a single system, use the following command, where rp is the response plot object and newSys is the updated model.

rp.Responses.SourceData.Model = newSys;

To change the model for the second system in a response plot with multiple responses, use the following command.

rp.Responses(2).SourceData.Model = newSys;