ssregest
Estimate statespace model by reduction of regularized ARX model
Syntax
Description
specifies
additional options using one or more sys
= ssregest(data
,nx
,Name,Value
)Name,Value
pair
arguments.
Examples
Estimate StateSpace Model by Reduction of Regularized ARX Model
Load estimation data.
load iddata2 z2;
z2
is an iddata
object that contains timedomain system response data.
Identify a thirdorder statespace model.
sys = ssregest(z2,3);
Estimate StateSpace Model With Input Delay
Load estimation data.
load iddata2 z2
Estimate a thirdorder statespace model with input delay.
sys = ssregest(z2,3,'InputDelay',2);
Configure the ARX Orders and Estimation Focus
Load estimation data.
load iddata2 z2;
Specify the order of the regularized ARX model used by the software during estimation. Also, set the estimation focus to simulation.
opt = ssregestOptions('ARXOrder',[100 100 1],'Focus','simulation');
Identify a thirdorder statespace model.
sys = ssregest(z2,3,opt);
Return Initial State Values Computed During Estimation
Load estimation data.
load iddata2 z2;
Obtain the initial state values when identifying a thirdorder statespace model.
[sys,x0] = ssregest(z2,3);
Compare Regularized StateSpace Models Estimated Using Impulse Response and Reduction of ARX Models
Load data.
load regularizationExampleData eData;
Create a transfer function model used for generating the estimation data (true system).
trueSys = idtf([0.02008 0.04017 0.02008],[1 1.561 0.6414],1);
Obtain regularized impulse response (FIR) model.
opt = impulseestOptions('RegularizationKernel','DC'); m0 = impulseest(eData,70,opt);
Convert the model into a statespace model and reduce the model order.
m1 = balred(idss(m0),15);
Obtain a second statespace model using regularized reduction of an ARX model.
m2 = ssregest(eData,15);
Compare the impulse responses of the true system and the estimated models.
impulse(trueSys,m1,m2,50); legend('trueSys','m1','m2');
Input Arguments
data
— Estimation data
iddata
 idfrd
 frd
Estimation data, specified as an iddata
, idfrd
or frd
(Control System Toolbox) object.
For timedomain estimation, data
must be
an iddata
object containing
the input and output signal values.
For frequencydomain estimation, data
can
be one of the following:
Recorded frequency response data (
frd
(Control System Toolbox) oridfrd
)iddata
object with its properties specified as follows:InputData
— Fourier transform of the input signalOutputData
— Fourier transform of the output signalDomain
—'Frequency'
The sample time
Ts
of theiddata
object must be nonzero.
nx
— Order of estimated model
positive scalar  positive vector  'best'
Order of the estimated model, specified as a positive scalar or vector.
If nx
is a vector, then ssregest
creates
a plot which you can use to choose a suitable model order. The plot
shows the Hankel singular values for models of chosen values in the
vector. States with relatively small Hankel singular values can be
safely discarded. A default choice is suggested in the plot.
You can also specify nx = 'best'
, as in ssregest(data,'best')
,
in which case the optimal order is chosen automatically in the 1:10
range.
opt
— Options set for ssregest
ssregestOptions
options set
Estimation options for ssregest
, specified
as an options set you create using ssregestOptions
.
NameValue Arguments
Specify optional pairs of arguments as
Name1=Value1,...,NameN=ValueN
, where Name
is
the argument name and Value
is the corresponding value.
Namevalue arguments must appear after other arguments, but the order of the
pairs does not matter.
Before R2021a, use commas to separate each name and value, and enclose
Name
in quotes.
Example: sys = ssregest(z2,3,'InputDelay',2)
specifies a delay of 2 sampling periods.
Ts
— Sample time
sample time of data (data.Ts
) (default)  positive scalar  0
Sample time of the model, specified as 0 or equal to the sample
time of data
.
For continuoustime models, use Ts = 0
. For
discretetime models, specify Ts
as a positive
scalar whose value is equal to the data sample time.
InputDelay
— Input delays
0 (default)  scalar  vector
Input delay for each input channel, specified as a numeric vector.
For continuoustime systems, specify input delays in the time unit
stored in the TimeUnit
property. For discretetime
systems, specify input delays in integer multiples of the sample time Ts
.
For example, InputDelay = 3
means a delay of three
sampling periods.
For a system with Nu
inputs, set InputDelay
to
an Nu
by1 vector. Each entry of this vector is
a numerical value that represents the input delay for the corresponding
input channel.
You can also set InputDelay
to a scalar value
to apply the same delay to all channels.
Form
— Type of canonical form
'free'
(default)  'modal'
 'companion'
 'canonical'
Type of canonical form of sys
,
specified as one of the following values:
'modal'
— Obtainsys
in modal form.'companion'
— Obtainsys
in companion form.'free'
— All entries of the A, B and C matrices are treated as free.'canonical'
— Obtainsys
in the observability canonical form [1].
Use the Form
, Feedthrough
and DisturbanceModel
namevalue
pair arguments to modify the default behavior of the A, B, C, D,
and K matrices.
Feedthrough
— Direct feedthrough from input to output
0
(default)  1
 logical vector
Direct feedthrough from input to output, specified as a logical
vector of length Nu, where Nu is
the number of inputs. If Feedthrough
is specified
as a logical scalar, it is applied to all the inputs.
Use the Form
, Feedthrough
and DisturbanceModel
namevalue
pair arguments to modify the default behavior of the A, B, C, D,
and K matrices.
DisturbanceModel
— Specify whether to estimate the K matrix
'estimate'
(default)  'none'
Specify whether to estimate the K matrix which specifies the noise component, specified as one of the following values:
'none'
— Noise component is not estimated. The value of the K matrix is fixed to zero value.'estimate'
— The K matrix is treated as a free parameter.
DisturbanceModel
must be 'none'
when
using frequencydomain data.
Use the Form
, Feedthrough
and DisturbanceModel
namevalue
pair arguments to modify the default behavior of the A, B, C, D,
and K matrices.
Output Arguments
sys
— Estimated statespace model
idss
Estimated statespace model of order nx
,
returned as an idss
model object.
The model represents:
$$\begin{array}{l}\dot{x}(t)=Ax(t)+Bu(t)+Ke(t)\\ y(t)=Cx(t)+Du(t)+e(t)\end{array}$$
A, B, C, D,
and K are statespace matrices. u(t)
is the input, y(t) is the output, e(t)
is the disturbance and x(t)
is the vector of nx
states.
All the entries of A, B, C,
and K are free estimable parameters by default. D is
fixed to zero by default, meaning that there is no feedthrough, except
for static systems (nx=0
).
Information about the estimation results and options used is
stored in the Report
property of the model. Report
has
the following fields:
Report Field  Description  

Status  Summary of the model status, which indicates whether the model was created by construction or obtained by estimation.  
Method  Estimation command used.  
InitialState  Handling of initial states during estimation, returned as one of the following values:
This field is especially useful when the  
ARXOrder  ARX model orders, returned as a matrix of nonnegative
integers  
Fit  Quantitative assessment of the estimation, returned as a structure. See Loss Function and Model Quality Metrics for more information on these quality metrics. The structure has the following fields:
 
Parameters  Estimated values of model parameters.  
OptionsUsed  Option set used for estimation. If no custom options
were configured, this is a set of default options. See  
RandState  State of the random number stream at the start of estimation. Empty,
 
DataUsed  Attributes of the data used for estimation, returned as a structure with the following fields.

For more information on using Report
, see Estimation Report.
x0
— Initial states computed during estimation
scalar  matrix
Initial states computed during estimation, returned as a scalar.
If data
contains multiple experiments, then x0
is a matrix with each column corresponding
to an experiment.
This value is also stored in the Parameters
field
of the model’s Report
property.
More About
Modal Form
In modal form, A is a blockdiagonal matrix. The block size is typically 1by1 for real eigenvalues and 2by2 for complex eigenvalues. However, if there are repeated eigenvalues or clusters of nearby eigenvalues, the block size can be larger.
For example, for a system with eigenvalues $$({\lambda}_{1},\sigma \pm j\omega ,{\lambda}_{2})$$, the modal A matrix is of the form
$$\left[\begin{array}{cccc}{\lambda}_{1}& 0& 0& 0\\ 0& \sigma & \omega & 0\\ 0& \omega & \sigma & 0\\ 0& 0& 0& {\lambda}_{2}\end{array}\right]$$
Companion Form
In the companion realization, the characteristic polynomial of the system appears explicitly in the rightmost column of the A matrix.
For a system with characteristic polynomial
$$P(s)={s}^{n}+{\alpha}_{1}{s}^{n1}+\dots +{\alpha}_{n1}s+{\alpha}_{n}$$
the corresponding companion A matrix is
$$A=\left[\begin{array}{ccc}\begin{array}{l}0\\ 1\\ 0\\ 0\\ \vdots \\ 0\end{array}& \begin{array}{l}0\\ 0\\ 1\\ 0\\ \vdots \\ 0\end{array}& \begin{array}{ccc}\begin{array}{cc}\begin{array}{l}0\\ 0\\ 0\\ 1\\ \vdots \\ 0\end{array}& \begin{array}{l}\dots \\ \dots \\ \dots \\ \dots \\ \ddots \\ \dots \end{array}\end{array}& \begin{array}{l}0\\ 0\\ 0\\ 0\\ \vdots \\ 1\end{array}& \begin{array}{l}{\alpha}_{n}\\ {\alpha}_{n1}\\ {\alpha}_{n2}\\ {\alpha}_{n3}\\ \text{}\vdots \\ {\alpha}_{1}\end{array}\end{array}\end{array}\right]$$
The companion transformation requires that the system be controllable from the first input. The companion form is poorly conditioned for most statespace computations; avoid using it when possible.
Tips
ssregest
function provides improved accuracy thann4sid
for short, noisy data sets.For some problems, the quality of fit using
n4sid
is sensitive to options, such asN4Horizon
, whose values can be difficult to determine. In comparison, the quality of fit withssregest
is less sensitive to its options, which makesssregest
simpler to use.
Algorithms
ssregest
estimates a regularized ARX model
and converts the ARX model to a statespace model. The software then
uses balanced model reduction techniques to reduce the statespace
model to the specified order.
References
[1] Ljung, L. System Identification: Theory For the User, Second Edition, Appendix 4A, pp 132134, Upper Saddle River, N.J: Prentice Hall, 1999.
Version History
Open Example
You have a modified version of this example. Do you want to open this example with your edits?
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)