modalreal
Syntax
Description
[___] = modalreal(
specifies options for controlling the block size and normalizing 2-by-2 blocks associated
with complex pairs.sys
,Name=Value
)
Examples
Convert State-Space Model to Modal Form
pendulumCartSSModel.mat
contains the state-space model of an inverted pendulum on a cart where the outputs are the cart displacement and the pendulum angle . The control input u
is the horizontal force on the cart.
First, load the state-space model sys
to the workspace.
load('pendulumCartSSModel.mat','sys');
Convert sys
to modal form and extract the block sizes.
[msys,blks,TL,TR] = modalreal(sys)
msys = A = x1 x2 x3 x4 x1 0 0 0 0 x2 0 -0.05 0 0 x3 0 0 -5.503 0 x4 0 0 0 5.453 B = u1 x1 1.875 x2 6.298 x3 12.8 x4 12.05 C = x1 x2 x3 x4 y1 16 -4.763 -0.003696 0.003652 y2 0 0.003969 -0.03663 0.03685 D = u1 y1 0 y2 0 Continuous-time state-space model.
blks = 4×1
1
1
1
1
TL = 4×4
0.0625 1.2500 -0.0000 -0.1250
0 4.1986 0.0210 -0.4199
0 0.2285 -13.5873 2.4693
0 -0.2251 13.6287 2.4995
TR = 4×4
16.0000 -4.7631 -0.0037 0.0037
0 0.2381 0.0203 0.0199
0 0.0040 -0.0366 0.0369
0 -0.0002 0.2015 0.2009
msys
is the modal realization of sys
, blks
represents the block sizes down the diagonal, and TL
and TR
represent the block-diagonalizing transformation matrices.
Modal Realization of Zero-Pole-Gain Model
For this example, consider the following system with doubled poles and clusters of close poles:
Create a zpk
model of this system and obtain a modal realization using the function modalreal
.
sys = zpk([1 -1],[0 -10 -10.0001 1+1i 1-1i 1+1i 1-1i],100); [msys1,blks1] = modalreal(sys); blks1
blks1 = 3×1
1
4
2
msys1.A
ans = 7×7
0 0 0 0 0 0 0
0 1.0000 2.1220 0 0 0 0
0 -0.4713 1.0000 1.5296 0 0 0
0 0 0 1.0000 1.8439 0 0
0 0 0 -0.5423 1.0000 0 0
0 0 0 0 0 -10.0000 4.0571
0 0 0 0 0 0 -10.0001
msys1.B
ans = 7×1
0.1600
-0.0052
0.0201
-0.0975
0.2884
0
4.0095
sys
has a pair of poles at s
=
-10
and s
=
-10.0001
, and two complex poles of multiplicity 2 at s
=
1+i
and s
=
1-i
. As a result, the modal form msys1
is a state-space model with a block of size 2 for the two poles near s
=
-10
, and a block of size 4 for the complex eigenvalues.
Now, separate the two poles near s
=
-10
by increasing the condition number of the block-diagonalizing transformation. Set SepTol
to 1e-10
for this example.
[msys2,blks2] = modalreal(sys,SepTol=1e-10); blks2
blks2 = 4×1
1
4
1
1
msys2.A
ans = 7×7
0 0 0 0 0 0 0
0 1.0000 2.1220 0 0 0 0
0 -0.4713 1.0000 1.5296 0 0 0
0 0 0 1.0000 1.8439 0 0
0 0 0 -0.5423 1.0000 0 0
0 0 0 0 0 -10.0000 0
0 0 0 0 0 0 -10.0001
msys2.B
ans = 7×1
105 ×
0.0000
-0.0000
0.0000
-0.0000
0.0000
1.6267
1.6267
The A
matrix of msys2
includes separate diagonal elements for the poles near s
=
-10
. Increasing the condition number results in some very large values in the B
matrix.
Normalize Diagonal Blocks in Modal Realizations
For this example, consider the following system with complex pair poles and clusters of close poles:
Create a zpk
model of this system and obtain a modal realization using the function modalreal
.
sys = zpk([1 -1],[0 -10 -10.0001 3+4i 3-4i],100); [msys1,blks1] = modalreal(sys); blks1
blks1 = 3×1
1
2
2
msys1.A
ans = 5×5
0 0 0 0 0
0 3.0000 8.7637 0 0
0 -1.8257 3.0000 0 0
0 0 0 -10.0000 8.8001
0 0 0 0 -10.0001
msys1
is a state-space model with a block of sizes 2 for the two poles near s
=
-10
, and a pair of complex poles at s
=
3+4i
and s
=
3-4i
.
You can normalize the values of 2-by-2 blocks to show the actual pole values using the Normalize
option. Additionally, relax the relative accuracy of the block diagonalizing transformation to separate the block near s
=
-10
.
[msys2,blks2] = modalreal(sys,Normalize=true,SepTol=1e-10); blks2
blks2 = 4×1
1
2
1
1
msys2.A
ans = 5×5
0 0 0 0 0
0 3.0000 4.0000 0 0
0 -4.0000 3.0000 0 0
0 0 0 -10.0000 0
0 0 0 0 -10.0001
For complex poles, this option normalizes the 2-by-2 block of complex poles to .
Input Arguments
sys
— Dynamic system
dynamic system model
Dynamic system, specified as a SISO, or MIMO dynamic system model. Dynamic systems that you can use include:
Continuous-time or discrete-time numeric LTI models, such as
tf
,zpk
,ss
, orpid
models.Generalized or uncertain LTI models such as
genss
oruss
(Robust Control Toolbox) models. (Using uncertain models requires Robust Control Toolbox™ software.)Identified LTI models, such as
idtf
(System Identification Toolbox),idss
(System Identification Toolbox),idproc
(System Identification Toolbox),idpoly
(System Identification Toolbox), andidgrey
(System Identification Toolbox) models. (Using identified models requires System Identification Toolbox™ software.)
You cannot use frequency-response data models such as frd
models.
Name-Value Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Name-value arguments must appear after other arguments, but the order of the
pairs does not matter.
Example: [msys,blks] = modalreal(sys,Normalize=true)
SepTol
— Relative accuracy of block diagonalization
1e-12
(default) | scalar between 0 and 1
Relative accuracy of block diagonalization, specified as a scalar between 0 and 1.
This option limits the condition number of the block diagonalizing transformation
to roughly SepTol
/eps
. Increasing
SepTol
helps yield smaller blocks at the expense of
accuracy.
Normalize
— Normalize diagonal blocks
false
or 0
(default) | true
or 1
Normalize 1-by-1 and 2-by-2 diagonal blocks, specified as a logical
0
(false
) or 1
(true
).
When Normalize
is true
, the function
normalizes the block to show the pole values.
For explicit models, the function normalizes 2-by-2 blocks associated with complex pairs a±jb to .
For descriptor models, the function normalizes
1-by-1 blocks to Aj = a, Ej = 1.
2-by-2 blocks to Aj = , Ej = I.
Output Arguments
msys
— Modal state-space realization
ss
model object
Modal state-space realization of the dynamic model, returned as an ss
model object. msys
is a realization where
A or (A,E) are block diagonal
and each block corresponds to a real pole, a complex pair, or a cluster of repeated
poles.
blks
— Block sizes
vector
Block sizes in the block-diagonal realization, returned as a vector.
TL
— Left-side matrix of block-diagonalizing transformation
matrix | []
Left-side matrix of the block-diagonalizing transformation, returned as a matrix
with dimensions Nx-by-Nx, where
Nx is the number of states in the model sys
.
The algorithm transforms the state-space realization (A, B, C, D, E) of a model to block diagonal matrices (Am, Bm, Cm, Dm, Em) given by:
For explicit state-space models
For descriptor state-space models
The function returns an empty value []
for this argument when the
input model sys
is not a state-space model.
TR
— Right-side matrix of block-diagonalizing transformation
matrix | []
Right-side matrix of the block-diagonalizing transformation, returned as a matrix
with dimensions Nx-by-Nx, where
Nx is the number of states in the model
sys
.The algorithm transforms the state-space realization
(A, B, C,
D, E) of a model to block diagonal matrices
(Am,
Bm,
Cm,
Dm,
Em) given by:
For explicit state-space models
For descriptor state-space models
The function returns an empty value []
for this argument when the
input model sys
is not a state-space model.
Version History
Introduced in R2023b
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
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)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)