Main Content

spy

Visualize sparsity pattern of a mechss model object

    Description

    example

    spy(sys) plots the sparsity pattern of the mechss model sys. The plot displays the number of non-zero elements in each sparse matrix of sys. You can right-click on the plot to select matrices to be displayed.

    spy(AX,sys) plots the sparsity pattern on the Axes or UIAxes object in the current figure with the handle AX. Use this syntax when creating apps with spy in the App Designer.

    Examples

    collapse all

    For this example, consider the sparse matrices for the 3-D beam model subjected to an impulsive point load at its tip in the file sparseBeam.mat.

    Extract the sparse matrices from sparseBeam.mat.

    load('sparseBeam.mat','M','K','B','F','G','D');

    Create the mechss model object by specifying [] for matrix C, since there is no damping.

    sys = mechss(M,[],K,B,F,G,D)
    Sparse continuous-time second-order model with 3 outputs, 1 inputs, and 3408 nodes.
    
    Use "spy" and "showStateInfo" to inspect model structure. 
    Type "properties('mechss')" for a list of model properties. 
    Type "help mechssOptions" for available solver options for this model.
    

    The output sys is a mechss model object containing a 3-by-1 array of sparse models with 3408 nodes, 1 input, and 3 outputs.

    You can use the spy command to visualize the sparsity of the mechss model object.

    spy(sys)

    For this example, consider the sparse matrices of the discrete system in the file discreteSOSparse.mat.

    Load the sparse matrices from discreteSOSparse.mat.

    load('discreteSOSparse.mat','M','C','K','B','F','G','D','ts');

    Create the discrete-time mechss model object by specifying the sample time ts.

    sys = mechss(M,C,K,B,F,G,D,ts)
    Sparse discrete-time second-order model with 1 outputs, 1 inputs, and 28408 nodes.
    
    Use "spy" and "showStateInfo" to inspect model structure. 
    Type "properties('mechss')" for a list of model properties. 
    Type "help mechssOptions" for available solver options for this model.
    

    The output sys is a discrete-time mechss model object with 28408 nodes, 1 input, and 1 output.

    You can use the spy command to visualize the sparsity pattern of the mechss model object. You can right-click on the plot to select matrices to be displayed.

    spy(sys)

    Input Arguments

    collapse all

    First-order sparse model, specified as a mechss model object. When the sparse model sys contains interfaced or interconnected components, use spy(xsort(sys)) to view the underlying block arrow structure. For more information about the block arrow structure, see xsort.

    Object handle, specified as an Axes or UIAxes object. Use AX to create apps with spy in the App Designer.

    See Also

    |

    Introduced in R2020b