Main Content

view

Plot relative fit error between original and fitted model

Since R2025a

    Description

    view(R) compares the original and fitted models by showing the gap between the two models relative to the original model.

    view(___,Parent=parent) creates a plot in the specified parent graphics container, such as a Figure or TiledChartLayout. Use this syntax when you want to create a plot in a specified open figure or when creating apps in App Designer. You can specify the parent container after any of the input argument combinations in the previous syntaxes.

    h = view(R,___) returns an SigmaPlot object. To customize your plot, modify properties of the plot object using dot notation.

    example

    Examples

    collapse all

    This example shows how to validate the quality of a fitted model when reducing model order using frequency response fitting method.

    For this example, generate a random discrete-time state-space model with 30 states.

    rng(3);
    sys = rss(30);

    Create the model order reduction object for frequency response fitting.

    R = reducespec(sys,'frfit');

    Specify additional options. Such as, for the reduced model, the absolute error must not exceed 0.05 at each specified frequency point.

    w = logspace(-2,2,50);
    R.Options.Frequency = w;
    R.Options.Feedthrough = 0;
    R.Options.AbsTol = 0.05;
    R.Options.RelTol = 0;

    Run the model reduction algorithm and visualize the frequency response of the original model and the fit error.

    R = process(R);
    view(R);

    MATLAB figure

    The error between the fitted and original models does not exceed the specified error of 0.05 (-26.02 dB).

    Obtain the reduced model from the rational fit.

    rsys = getrom(R);

    The view function can also return a SigmaPlot object. You can further customize this plot by modifying the properties of the object. For this example, enable the minor grid type and add the response of the reduced model on the same plot.

    h = view(R);
    h.AxesStyle.MinorGridVisible = "on";
    h.YLimits = [-100 50];
    addResponse(h,rsys,w,LineStyle="--");

    MATLAB figure

    Input Arguments

    collapse all

    Model order reduction specification object created using reducespec, specified as a FrequencyResponseFitting object.

    Parent graphics container, specified as one of these objects:

    • Figure

    • TiledChartLayout

    • UIFigure

    • UIGridLayout

    • UIPanel

    • UITab

    You can also specify parent as an Axes or UIAxes object, which sets the plot parent to the parent of the specified axes object.

    Output Arguments

    collapse all

    Singular value plot object, returned as an SigmaPlot chart object. To customize the plot, modify the properties of h using dot notation. For all available properties of SigmaPlot, see SigmaPlot Properties.

    Version History

    Introduced in R2025a