Main Content

openloopeditor

Open-loop editor for SISO control systems

Since R2025a

    Description

    ole = openloopeditor(Plant=plant) creates an open-loop editor for tuning a compensator for plant plant and returns a corresponding OpenLoopEditor object. In this case, the editor opens in a new figure using a Bode editor view.

    • If you do not specify the plant when you create the editor, you must define the plant before tuning by setting the Plant property of ole.

    • To obtain the tuned compensator, use the Compensator property of ole.

    For more information on designing a compensator using a standalone open-loop editor, see Design Compensator Using Open-Loop Editor.

    example

    ole = openloopeditor(parent) creates a default open-loop editor in the specified parent graphics container, such as a UIGridLayout, and sets the Parent property. Use this syntax when you want to create an editor in a specified open figure or when creating apps in App Designer.

    For an app-creation example, see Create Open-Loop Control Design App.

    example

    ole = openloopeditor(___,Name=Value) configures the open-loop editor using one or more name-value arguments. For example, openloopeditor(Plant=sys,ViewType="rlocus") specifies the plant as dynamic system model sys and configures the editor view as a root locus editor.

    example

    Examples

    collapse all

    Create a standalone open-loop editor to tune a compensator for a specified plant.

    Specify a SISO plant for tuning. For this example, use a random third-order state-space system.

    G = rss(3);

    Create an open-loop editor for this plant.

    ole = openloopeditor(Plant=G);

    Open-loop editor showing the default Bode Editor view with two axes: a magnitude plot on top and a phase plot on the bottom.

    A default Bode editor opens in a new figure. To change the appearance of the Bode editor, for example to add grid lines or change axis limits, you can modify the returned ole object.

    Interactively tune the controller using the open-loop editor. For an example, see Design Compensator Using Open-Loop Editor.

    After tuning, obtain the final compensator from the Compensator property of ole.

    C = ole.Compensator;

    During tuning, you can plot the closed-loop step response of the combined compensator and plant.

    CL = feedback(ole.Plant*ole.Compensator,1);
    stepplot(CL)

    Create a standalone open-loop editor to tune a compensator for a specified plant using a root locus editor view.

    Specify a SISO plant for tuning. For this example, use a random third-order state-space system.

    G = rss(3);

    Create a root locus editor for this plant.

    ole = openloopeditor(Plant=G,ViewType="rlocus");

    Open-loop editor showing the default Root Locus Editor view.

    A root locus editor opens in a new figure.

    Interactively tune the controller using the open-loop editor. For an example, see Design Compensator Using Open-Loop Editor.

    After tuning, obtain the final compensator from the Compensator property of ole.

    C = ole.Compensator;

    You can create linear analysis plots that automatically update when you modify a compensator using an open-loop editor. This example creates a Bode editor and a step plot in separate figures and updates the step plot when the compensator changes.

    Create SISO plant.

    plant = rss(3);

    Create open-loop editor.

    ole = openloopeditor(Plant=plant);

    Create step plot in a separate figure and plot the initial closed-loop response with a unit-gain compensator.

    sp = stepplot(feedback(plant,1));

    Define a callback function that updates the step plot when the compensator value changes. Here, src is the event source (open-loop editor) and data is an event data structure that contains the updated compensator..

    function updateStepPlot(src,data,sp)
        sp.Responses(1).SourceData.Model = ...
            feedback(src.Plant*data.Compensator,1);
    end

    Set the callback function in the open-loop editor to the updateStepPlot function and pass the step-plot object as an additional input argument.

    ole.CompensatorChangedFcn = @(src,data) updateStepPlot(src,data,sp);

    When you modify the compensator using the open-loop editor, the step plot updates to show the new closed-loop response.

    This example creates a root locus editor and a step plot in a single figure and updates the step plot when the compensator changes.

    Create SISO plant.

    plant = rss(3);

    Create a figure that contains a grid layout with one row and two columns. Increase the height and width of the figure by 40%.

    f = uifigure(Name="Open-Loop Editor");
    f.Position(3) = f.Position(3)*1.4;
    f.Position(4) = f.Position(4)*1.4;
    gl = uigridlayout(f,[1 2]);

    Create an open-loop editor and add it to the grid layout.

    ole = openloopeditor(gl,Plant=plant,ViewType="rlocus");

    Create a step plot of the initial closed-loop response and add it to the grid layout.

    sp = stepplot(gl,feedback(plant,1));

    Dialog window with two axes: a Root Locus Editor on the right and a step response on the right

    Define a callback function that updates the step plot when the compensator value changes. Here, src is the event source (open-loop editor) and data is an event data structure.

    function updateStepPlot(src,data,sp)
        sp.Responses(1).SourceData.Model = ...
            feedback(src.Plant*data.Compensator,1);
    end

    Set the callback function in the open-loop editor using a handle to the updateStepPlot function.

    ole.CompensatorChangedFcn = @(src,data) updateStepPlot(src,data,sp);

    When you modify the compensator using the open-loop editor, the step plot updates to show the new closed-loop response.

    Input Arguments

    collapse all

    Parent graphics container, specified as one of these objects:

    • Figure

    • UIFigure

    • UIGridLayout

    • UIPanel

    • UITab

    Fixed plant for which the compensator is being designed, specified as a SISO dynamic system model or an array of such systems.

    This argument sets the Plant property of the editor.

    Name-Value Arguments

    collapse all

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: openloopeditor(ViewType="rlocus") configures the editor view as a root locus editor

    Note

    The properties listed here are only a subset. For a complete list, see OpenLoopEditor Properties.

    Fixed plant for which the compensator is being designed, specified as a SISO dynamic system model or an array of such systems.

    This argument sets the Plant property of the editor.

    Compensator, specified as a SISO dynamic system model and stored as a zpk object. You can modify the compensator gain, poles, and zeros either interactively using the open-loop editor or programmatically using the Compensator property.

    This argument sets the Compensator property of the editor.

    Editor view type, specified as one of these values:

    • "bode" — Bode editor view

    • "nichols" — Nichols editor view

    • "rlocus" — Root locus editor view

    This argument sets the ViewType property of the editor.

    Editor view configuration options, specified as one of these objects:

    This argument sets a subset of the parameters in the View property of the editor.

    Output Arguments

    collapse all

    Open-loop editor component, returned as an OpenLoopEditor object. You can modify the appearance and behavior of the editor using dot notation.

    Version History

    Introduced in R2025a