Main Content

view

Plot state contributions when using balanced truncation of normalized coprime factors method

Since R2023b

    Description

    Use view to graphically analyze the model and select a model order reduction criteria from a model order reduction task created using reducespec. For NCFBalancedTruncation objects, you can visualize the state contributions of the normalized coprime factorization of the full-order model as either Hankel singular values or normalized state energies. For the full workflow, see Task-Based Model Order Reduction Workflow.

    example

    view(R,type) creates a plot that helps you select the order of the reduced model. R specifies the model order reduction (MOR) specification object. Use the type argument to specify the plot type as either "sigma" or "energy".

    view(R) plots the default plot type for the model order reduction algorithm of R. For balanced truncation methods, this syntax plots Hankel singular values and associated error bounds.

    view(___,Axes=AX) plots on the Axes object in the current figure with the handle AX. Use this input argument after any of the input argument combinations in the previous syntaxes. For more information about customizing axes, see Axes Properties.

    example

    view(___,Name=Value) specifies additional options for customizing the appearance of Hankel singular value plots. For example, view(R,"sigma",Axes=AX,YScale="Linear") plots the Hankel singular values into the axes with handle AX using a linear scale for y axis.

    example

    h = view(R,___) returns a plot handle h. Use h to modify properties of the plot after creating it.

    view(R,"-help") returns help specific to the model order specification object R. The returned help shows plot types and syntaxes applicable to R.

    Examples

    collapse all

    This example shows how to obtain a reduced-order model using the balanced truncation of normalized coprime factors method.

    Load a 30-state plant model G.

    load ncfModel.mat G
    size(G)
    State-space model with 2 outputs, 3 inputs, and 30 states.
    

    Create a model order reduction task.

    R = reducespec(G,"ncf");

    To help you select a suitable target reduction order, examine the plot of Hankel singular values and approximation errors.

    Create the plot.

    view(R)

    Figure contains an axes object. The axes object with title Hankel Singular Values and Approximation Error, xlabel Order (Number of States), ylabel State Contribution contains 3 objects of type bar, line. These objects represent Unstable modes, Stable modes, Absolute error bound.

    The function generates a Hankel singular value plot, which shows the relative energy contributions of each state in the coprime factorization of G, arranged in decreasing order by energy. The plot also shows the upper bound on the error between the original and reduced-order models that you obtain by truncating the states at that point. Examine this plot to choose the target order. For instance, for a maximum error of 0.01, you can reduce the model to 13th order.

    Examine the singular values of G and of the difference between G and Gred.

    Gred = getrom(R,MaxError=0.01);
    sigma(G,G-Gred)
    legend("G","G-Gred")

    Figure contains an axes object. The axes object contains 4 objects of type line. These objects represent G, G-Gred.

    The difference is small across all frequencies, showing that the reduced-order model is a good approximation of the full-order model.

    This example shows how customize the state contribution plots obtained using the view function in the model order reduction workflow.

    For this example, create a model order reduction specification for an LTI model using the balanced truncation of normalized coprime factors method.

    Generate a random discrete-time state-space model with 40 states.

    rng(0)
    sys = drss(40);

    Create a specification object.

    R = reducespec(sys,"ncf");

    Visualize the Hankel singular values.

    view(R)

    Figure contains an axes object. The axes object with title Hankel Singular Values and Approximation Error, xlabel Order (Number of States), ylabel State Contribution contains 3 objects of type bar, line. These objects represent Unstable modes, Stable modes, Absolute error bound.

    To customize the plots for balanced truncation methods, you can use hsvoptions properties as input arguments.

    h = view(R,"sigma",YScale="linear")
    h =
    
    	resppack.hsvplot
    

    You can further customize this plot using the setoptions command.

    setoptions(h,'Grid','off')

    Figure contains an axes object. The axes object with title Hankel Singular Values and Approximation Error, xlabel Order (Number of States), ylabel State Contribution contains 3 objects of type bar, line. These objects represent Unstable modes, Stable modes, Absolute error bound.

    Input Arguments

    collapse all

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

    Plot type, specified as one of the following.

    • "sigma" — Bar chart of Hankel singular values and associated error bound

    • "energy" — Bar chart of normalized energies

    If you do not specify this argument, the function plots the Hankel singular values and associated error bounds of the normalized coprime factorization of the original model sys.

    Output Arguments

    collapse all

    Plot handle object, returned as an hsvplot object.

    Use setoptions with this handle to customize the plot. For example, setoptions(h,'Grid','off'). For a list of available options, see hsvoptions.

    Version History

    Introduced in R2023b