Main Content

mechssdata

Access second-order sparse state-space model data

Since R2020b

    Description

    example

    [M,C,K,B,F,G,D] = mechssdata(sys) returns the M, C, K, B, F, G and D matrices of the sparse state-space model sys. If sys is not a mechss model, it is first converted to mechss model form.

    When your system has internal delays, mechssdata returns the matrices for pade(sys,0), which involves feedback loops around the internal delays and the model is retained in differential algebraic equation (DAE). As a result, the size of matrices M, C, and K are typically larger than the order of sys since they are augmented by the feedback signals to preserve sparsity.

    example

    [M,C,K,B,F,G,D,ts] = mechssdata(sys) also returns the sample time ts.

    example

    ___ = mechssdata(sys,J1,...,JN) extracts the data for the J1,...,JN entry in the model array sys.

    Examples

    collapse all

    For this example, consider sparseSOModels.mat which contains a continuous-time mechss model sys1.

    Load the model sys1 to the workspace and use mechssdata to extract the sparse matrices.

    load('sparseSOModels.mat','sys1');
    size(sys1)
    Sparse second-order model with 2 outputs, 2 inputs, and 299 degrees of freedom.
    
    [M,C,K,B,F,G,D] = mechssdata(sys1);

    The matrices are returned as arrays of sparse doubles.

    For this example, consider sparseSOModels.mat which contains a discrete-time mechss model sys2.

    Load the model sys2 to the workspace and use mechssdata to extract the sparse matrices.

    load('sparseSOModels.mat','sys2');
    size(sys2)
    Sparse second-order model with 3 outputs, 3 inputs, and 108 degrees of freedom.
    
    [M,C,K,B,F,G,D,ts] = mechssdata(sys2);

    The matrices are returned as arrays of sparse doubles.

    For this example, extract sparse matrices for a specific sparse second-order state-space model contained in the 3x1 array of sparse second-order models sys.

    Load the data and extract the sparse matrices of the second model in the array.

    load('sparseSOModelArray.mat','sys');
    size(sys)
    1x3 array of sparse second-order models.
    Each model has 1 outputs, 3 inputs, and 1174 degrees of freedom.
    
    [M,C,K,B,F,G,D] = mechssdata(sys,1,2);

    Input Arguments

    collapse all

    Dynamic system, specified as a SISO or MIMO dynamic system model, or an array of SISO or MIMO dynamic system models. Dynamic systems that you can use include continuous-time or discrete-time numeric LTI models such as mechss, sparss, tf, ss and zpk models.

    If sys is not a mechss model object, it is first converted to a second-order sparse state-space model using mechss. For more information on the format of the second-order sparse state-space model data, see the mechss reference page.

    Indices of models in array whose data you want to access, specified as a positive integer. You can provide as many indices as there are array dimensions in sys. For example, if sys is a 4-by-5 array of sparse models, the following command accesses the data for entry (2,3) in the array.

    [M,C,K,B,F,G,D] = mechssdata(sys,2,3);

    Output Arguments

    collapse all

    Mass matrix, returned as an Nq-by-Nq sparse matrix where, Nq is the number of nodes.

    Damping matrix, returned as an Nq-by-Nq sparse matrix where, Nq is the number of nodes.

    Stiffness matrix, returned as an Nq-by-Nq sparse matrix where, Nq is the number of nodes.

    Input-to-state matrix, returned as an Nq-by-Nu sparse matrix where, Nq is the number of nodes and Nu is the number of inputs.

    Displacement-to-output matrix, returned as an Ny-by-Nq sparse matrix where, Nq is the number of nodes and Ny is the number of outputs.

    Velocity-to-output matrix, returned as an Ny-by-Nq sparse matrix where, Nq is the number of nodes and Ny is the number of outputs.

    Input-to-output matrix, returned as an Ny-by-Nu sparse matrix where, Ny is the number of outputs and Nu is the number of inputs. D is also called as the static gain matrix which represents the ratio of the output to the input under steady state condition.

    Sample time, returned as a scalar.

    Version History

    Introduced in R2020b