Main Content

sparssdata

Access first-order sparse state-space model data

    Description

    example

    [A,B,C,D,E] = sparssdata(sys) returns the A, B, C, D, E matrices of the sparse state-space model sys. If sys is not a sparss model, it is first converted to sparss model form.

    When your system has internal delays, sparssdata returns the matrices for pade(sys,0), which involves feedback loops around the interval delays and the model is retained in differential algebraic equation (DAE) form to preserve sparsity. As a result, the size of matrices A and E are typically larger than the order of sys.

    example

    [A,B,C,D,E,ts] = sparssdata(sys) also returns the sample time ts.

    example

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

    Examples

    collapse all

    For this example, consider sparseFOData.mat which contains a continuous-time sparss model sys1.

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

    load('sparseFOData.mat','sys1');
    size(sys1)
    Sparse state-space model with 1 outputs, 2 inputs, and 199 states.
    
    [A,B,C,D,E] = sparssdata(sys1);

    The matrices are returned as arrays of sparse doubles.

    For this example, consider sparseFOData.mat which contains a discrete-time sparss model sys2.

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

    load('sparseFOData.mat','sys2');
    size(sys2)
    Sparse state-space model with 1 outputs, 1 inputs, and 235 states.
    
    [A,B,C,D,E,ts] = sparssdata(sys2);

    The matrices are returned as arrays of sparse doubles.

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

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

    load('sparseFOData.mat','sys3');
    size(sys3)
    1x3 array of sparse state-space models.
    Each model has 1 outputs, 3 inputs, and 671 states.
    
    [A,B,C,D,E] = sparssdata(sys3,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 sparss, mechss, tf, ss and zpk models.

    If sys is not a sparss model, it is first converted to first-order sparse form using sparss. For more information on the format of sparse first-order state-space model data, see the sparss 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.

    [A,B,C,D,E] = sparssdata(sys,2,3);

    Output Arguments

    collapse all

    State matrix, returned as an Nx-by-Nx sparse matrix where, Nx is the number of states.

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

    State-to-output matrix, returned as an Ny-by-Nx sparse matrix where Nx is the number of states 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.

    Mass matrix, returned as a Nx-by-Nx sparse matrix. E is the same size as A.

    Sample time, returned as a scalar.

    Introduced in R2020b