Professional Documents
Culture Documents
sparss
Sparse (rst-order state-space model
Since R2020b
Description
Use sparss to represent sparse descriptor state-space models using matrices obtained from your (nite element analysis (FEA)
package. FEA involves the concept of dynamic substructuring where a mechanical system is partitioned into components that are
modeled separately. These components are then coupled using rigid or semi-rigid physical interfaces that express consistency of
displacements and equilibrium of internal forces. The resultant matrices from this type of modeling are quite large with a sparse
pattern. Hence, using sparss is an eGcient way to represent such large sparse state-space models in MATLAB® to perform linear
analysis. You can also use sparss to convert a second-order mechss model object to a sparss object.
You can use sparss model objects to represent SISO or MIMO state-space models in continuous time or discrete time. In
continuous time, a (rst-order sparse state-space model is represented in the following form:
dx
E = A x(t) + B u(t)
dt
y(t) = C x(t) + D u(t)
Here, x, u and y represent the states, inputs and outputs respectively, while A, B, C, D and E are the state-space matrices. The sparss
object represents a state-space model in MATLAB storing sparse matrices A, B, C, D and E along with other information such as
sample time, names and delays speci(c to the inputs and outputs.
Creation
Syntax
sys = sparss(A,B,C,D,E)
sys = sparss(A,B,C,D,E,ts)
sys = sparss(D)
sys = sparss( ___ ,Name,Value)
sys = sparss(ltiSys)
Description
sys = sparss(A,B,C,D,E) creates a continuous-time (rst-order sparse state-space model object of the example
following form:
dx
E = A x(t) + B u(t)
dt
y(t) = C x(t) + D u(t)
For instance, consider a plant with Nx states, Ny outputs, and Nu inputs. The (rst-order state-space matrices are:
https://it.mathworks.com/help/control/ref/sparss.html Page 1 of 10
Sparse first-order state-space model - MATLAB - MathWorks Italia 03/04/23, 10:14 AM
E is the sparse mass matrix with the same size as matrix A. When E is omitted, sparss populates E with an
identity matrix.
example
sys = sparss(A,B,C,D,E,ts) creates a discrete-time sparse state-space model with sample time ts with
the form:
To leave the sample time unspeci(ed, set ts to -1. When E is an identity matrix, you can set E as [] or omit E as
long as A is not a scalar.
example
sys = sparss(D) creates a sparse state-space model that represents the static gain, D. The output state-
space model is equivalent to sparss([],[],[],D,[]).
example
sys = sparss( ___ ,Name,Value) sets properties of the (rst-order sparse state-space model using one or
more name-value pair arguments. Use this syntax with any of the previous input-argument combinations.
sys = sparss(ltiSys) converts the dynamic system model ltiSys to a (rst-order sparse state-space example
model.
A — State Matrix
Nx-by-Nx sparse matrix
B — Input-to-state matrix
Nx-by-Nu sparse matrix
C — State-to-output matrix
Ny-by-Nx sparse matrix
D — Input-to-output matrix
Ny-by-Nu sparse matrix
E — Mass matrix
Nx-by-Nx sparse matrix
ts — Sample time
scalar
https://it.mathworks.com/help/control/ref/sparss.html Page 2 of 10
Sparse first-order state-space model - MATLAB - MathWorks Italia 03/04/23, 10:14 AM
A — State matrix
Nx-by-Nx sparse matrix
B — Input-to-state matrix
Nx-by-Nu sparse matrix
C — State-to-output matrix
Ny-by-Nx sparse matrix
D — Input-to-output matrix
Ny-by-Nu sparse matrix
E — Mass matrix
Nx-by-Nx sparse matrix
Ts — Sample time
0 (default) | positive scalar | -1
https://it.mathworks.com/help/control/ref/sparss.html Page 3 of 10
Sparse first-order state-space model - MATLAB - MathWorks Italia 03/04/23, 10:14 AM
Object Functions
The following lists show functions you can use with sparss model objects. expand all
Modeling
Data Access
Model Transformation
Model Interconnection
https://it.mathworks.com/help/control/ref/sparss.html Page 4 of 10
Sparse first-order state-space model - MATLAB - MathWorks Italia 03/04/23, 10:14 AM
For this example, consider sparseFOContinuous.mat which contains sparse Open in MATLAB Online
matrices for a continuous-time sparse (rst-order state-space model.
load('sparseFOContinuous.mat','A','B','C','D','E');
sys = sparss(A,B,C,D,E)
Sparse continuous-time state-space model with 1 outputs, 1 inputs, and 199 states.
You can use the spy command to visualize the sparsity of the sparss model object.
spy(sys)
load('sparseFODiscrete.mat','A','B','C','D','E','ts');
https://it.mathworks.com/help/control/ref/sparss.html Page 5 of 10
Sparse first-order state-space model - MATLAB - MathWorks Italia 03/04/23, 10:14 AM
sys = sparss(A,B,C,D,E,ts)
Sparse discrete-time state-space model with 1 outputs, 1 inputs, and 398 states.
You can use the spy command to visualize the sparsity of the sparss model object.
spy(sys)
You can also view model properties of the sparss model object.
properties('sparss')
https://it.mathworks.com/help/control/ref/sparss.html Page 6 of 10
Sparse first-order state-space model - MATLAB - MathWorks Italia 03/04/23, 10:14 AM
A
B
C
D
E
Scaled
StateInfo
SolverOptions
InternalDelay
InputDelay
OutputDelay
InputName
InputUnit
InputGroup
OutputName
OutputUnit
OutputGroup
Notes
UserData
Name
Ts
TimeUnit
SamplingGrid
[6 3 9]
1 5 7 Copy Command
D=
Specify the gain matrix and create the static gain sparse (rst-order state-space model.
D = [1,5,7;6,3,9];
sys = sparss(D);
size(sys)
load('mechssModel.mat','ltiSys');
ltiSys
https://it.mathworks.com/help/control/ref/sparss.html Page 7 of 10
Sparse first-order state-space model - MATLAB - MathWorks Italia 03/04/23, 10:14 AM
Sparse continuous-time second-order model with 1 outputs, 1 inputs, and 872 degrees of freedom.
sys = sparss(ltiSys)
Sparse continuous-time state-space model with 1 outputs, 1 inputs, and 1744 states.
Load the sparse matrices and create the sparss object. Copy Command
load sparseFOSignal.mat
plant = sparss(A,B,C,D,E,'Name','Plant');
con = pid(1,1,0.1,0.01,'Name','Controller');
Use the feedback command to connect the plant, sensor, actuator, and controller in a feedback loop.
sys = feedback(sen*plant*act*con,1)
showStateInfo(sys)
https://it.mathworks.com/help/control/ref/sparss.html Page 8 of 10
Sparse first-order state-space model - MATLAB - MathWorks Italia 03/04/23, 10:14 AM
sysSort = xsort(sys);
showStateInfo(sysSort)
You can also visualize the sparsity pattern of the resultant system using spy.
spy(sysSort)
https://it.mathworks.com/help/control/ref/sparss.html Page 9 of 10
Sparse first-order state-space model - MATLAB - MathWorks Italia 03/04/23, 10:14 AM
References
[1] M. Hosea and L. Shampine. "Analysis and implementation of TR-BDF2." Applied Numerical Mathematics, vol. 20, no. 1-2, pp. 21-37,
1996.
Version History
Introduced in R2020b
See Also
sparssdata | mechss | showStateInfo | xsort | full | getx0 | spy | Descriptor State-Space (Simulink)
Topics
Sparse Model Basics
https://it.mathworks.com/help/control/ref/sparss.html Page 10 of 10