Compute companion state-space realization
"c"— Computes the controllable companion realization for a single-input LTI model
sys. This is the same as the first syntax.
"o"— Computes the observable companion realization for a single-output LTI model
Convert State-Space Model to Companion Canonical Form
aircraftPitchSSModel.mat contains the state-space matrices of an aircraft where the input is elevator deflection angle and the output is the aircraft pitch angle .
Load the model data to the workspace and create the state-space model
load('aircraftPitchSSModel.mat'); sys = ss(A,B,C,D)
sys = A = x1 x2 x3 x1 -0.313 56.7 0 x2 -0.0139 -0.426 0 x3 0 56.7 0 B = u1 x1 0.232 x2 0.0203 x3 0 C = x1 x2 x3 y1 0 0 1 D = u1 y1 0 Continuous-time state-space model.
Convert the resultant state-space model
sys to controllable companion form.
csys = compreal(sys)
csys = A = x1 x2 x3 x1 0 0 1.914e-15 x2 1 0 -0.9215 x3 0 1 -0.739 B = u1 x1 1 x2 0 x3 0 C = x1 x2 x3 y1 0 1.151 -0.6732 D = u1 y1 0 Continuous-time state-space model.
csys is the controllable companion form of
Convert System to Observable Companion Form
icEngine.mat contains one data set with 1500 input-output samples collected at the a sampling rate of 0.04 seconds. The input
u(t) is the voltage (V) controlling the By-Pass Idle Air Valve (BPAV), and the output
y(t) is the engine speed (RPM/100).
Use the data in
icEngine.mat to create a state-space model with identifiable parameters.
load icEngine.mat z = iddata(y,u,0.04); sys = n4sid(z,4,'InputDelay',2);
Convert the identified state-space model
sys to observable companion form.
[osys,T] = compreal(sys,"o");
Compare frequency response confidence bounds of
h = bodeplot(sys,osys,'r.'); showConfidence(h)
The frequency response confidence bounds are identical.
compreal returns a transformation matrix
T such that the observable companion form is , , .
sys — Dynamic system
dynamic system model
Dynamic system, specified as a SISO, or MIMO dynamic system model. Dynamic systems that you can use include:
Identified LTI models, such as
idtf(System Identification Toolbox),
idss(System Identification Toolbox),
idproc(System Identification Toolbox),
idpoly(System Identification Toolbox), and
idgrey(System Identification Toolbox) models. (Using identified models requires System Identification Toolbox™ software.)
You cannot use frequency-response data models such as
type — Companion realization type
"c" (default) |
Companion realization type, specified as
companion form) or
"o" (observable companion form).
For a system with characteristic polynomial
the function returns the companion forms as follows.
Controllable Companion Form
In the controllable companion realization, the characteristic polynomial of the system appears explicitly in the rightmost column of the A matrix.
Observable Companion Form
In the observable companion realization, the characteristic polynomial of the system appears explicitly in the last row of the A matrix.
For more information, see State-Space Realizations.
T — Transformation matrix
Transformation matrix, returned as an n-by-n matrix, where n is the number of states.
For explicit state-space models with matrices A, B, C, the function returns
The controllable companion form is T-1AT, T-1B, CT.
The observable companion form is TAT-1, TB, CT-1.
For descriptor state-space models, the function always returns an empty value
Computing companion realizations often involves ill-conditioned transformations and loss
of accuracy. Use
balreal as numerically
Introduced in R2023b