spy
Syntax
Description
spy(
plots the sparsity pattern of the
sparse model sys
)sys
, which can be a first-order
(sparss
) or second-order (mechss
) model. The
plot displays the number of nonzero elements in each sparse matrix of
sys
. To display a matrix, right click the plot and select the desired matrix.
Examples
Continuous-Time Sparse First-Order Model
For this example, consider sparseFOContinuous.mat
which contains sparse matrices for a continuous-time sparse first-order state-space model.
Extract the sparse matrices from sparseFOContinuous.mat
.
load('sparseFOContinuous.mat','A','B','C','D','E');
Create the sparss
model object.
sys = sparss(A,B,C,D,E)
Sparse continuous-time state-space model with 1 outputs, 1 inputs, and 199 states. Use "spy" and "showStateInfo" to inspect model structure. Type "help sparssOptions" for available solver options for this model.
The output sys
is a continuous-time sparss
model object with 199 states, 1 input and 1 output.
You can use the spy
command to visualize the sparsity of the sparss
model object.
spy(sys)
Discrete-Time Sparse First-Order Model
For this example, consider sparseFODiscrete.mat
which contains sparse matrices for a discrete-time sparse first-order state-space model.
Extract the sparse matrices from sparseFODiscrete.mat
.
load('sparseFODiscrete.mat','A','B','C','D','E','ts');
Create the sparss
model object.
sys = sparss(A,B,C,D,E,ts)
Sparse discrete-time state-space model with 1 outputs, 1 inputs, and 398 states. Use "spy" and "showStateInfo" to inspect model structure. Type "help sparssOptions" for available solver options for this model.
The output sys
is a discrete-time sparss
model object with 398 states, 1 input and 1 output.
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')
Properties for class sparss: A B C D E Offsets Scaled StateInfo SolverOptions InternalDelay InputDelay OutputDelay InputName InputUnit InputGroup OutputName OutputUnit OutputGroup Notes UserData Name Ts TimeUnit SamplingGrid
Continuous-Time Sparse Second-Order Model
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 degrees of freedom. Use "spy" and "showStateInfo" to inspect model structure. 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 degrees of freedom, 1 input, and 3 outputs.
You can use the spy
command to visualize the sparsity of the mechss
model object.
spy(sys)
Discrete-Time Sparse Second-Order Model
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 degrees of freedom. Use "spy" and "showStateInfo" to inspect model structure. Type "help mechssOptions" for available solver options for this model.
The output sys
is a discrete-time mechss
model object with 28408 degrees of freedom, 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
sys
— Sparse model
sparss
object | mechss
object
Sparse model, specified as a one of the following objects.
When 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
.
AX
— Object handle
Axes
object | UIAxes
object
Object handle, specified as an Axes
or UIAxes
object. Use AX
to create apps with spy
in the
App Designer.
Version History
Introduced in R2020b
Comando MATLAB
Hai fatto clic su un collegamento che corrisponde a questo comando MATLAB:
Esegui il comando inserendolo nella finestra di comando MATLAB. I browser web non supportano i comandi MATLAB.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list:
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)