Estimate statespace model using time or frequency domain data
sys = ssest(data,nx)
sys = ssest(data,nx,Name,Value)
sys = ssest(___,opt)
sys = ssest(data,init_sys)
sys = ssest(data,init_sys,opt)
[sys,x0] = ssest(___)
estimates
a statespace model, sys
= ssest(data
,nx
)sys
,
using time or frequencydomain data, data
. sys
is a statespace model of order nx
and
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
).
estimates
the model using the additional options specified by one or more sys
= ssest(data
,nx
,Name,Value
)Name,Value
pair
arguments. Use the Form
, Feedthrough
and DisturbanceModel
namevalue
pair arguments to modify the default behavior of the A, B, C, D,
and K matrices.
estimates the model using an option set, sys
= ssest(___,opt
)opt
,
that specifies options such as estimation objective, handling of initial
conditions and numerical search method used for estimation.

Identified statespace model, returned as a Information about the estimation results and options used is
stored in the
For more information on using  

Initial states computed during the estimation. If This value is also stored in the 
Obtain measured inputoutput data.
load icEngine.mat;
data = iddata(y,u,0.04);
data
is an iddata
object
containing 1500 inputoutput data samples. The data sample time is
0.04 seconds.
Estimate a statespace model for measured inputoutput data. Determine the optimal model order within a given model order range.
nx = 1:10; sys = ssest(data,nx);
A plot that shows the Hankel singular values (SVD) for models
of the orders specified by nx
appears.
States with relatively small Hankel singular values can be safely
discarded. The suggested default order choice is 3
.
Select the model order in the Model Order dropdown list and click Apply.
Load timedomain system response data.
load iddata7 z7;
Identify a fourthorder statespace model of the data. Specify a known delay of 2
seconds for the first input and 0
seconds for the second input.
nx = 4;
sys = ssest(z7(1:300),nx,'InputDelay',[2;0]);
Obtain a regularized 5th order statespace model for a 2nd order system from a narrow bandwidth signal.
Load estimation data.
load regularizationExampleData eData;
Create the 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);
Estimate an unregularized statespace model.
opt = ssestOptions('SearchMethod','lm'); m = ssest(eData,5,'form','modal','DisturbanceModel','none','Ts',eData.Ts,opt);
Estimate a regularized statespace model.
opt.Regularization.Lambda = 10; mr = ssest(eData,5,'form','modal','DisturbanceModel','none','Ts',eData.Ts,opt);
Compare the model outputs with the estimation data.
compare(eData,m,mr);
Compare the model impulse responses.
impulse(trueSys,m,mr,50); legend('trueSys','m','mr');
Estimate a statespace model of measured inputoutput data. Configure the parameter constraints and initial values for estimation using a statespace model.
Create an idss
model to specify the initial parameterization for estimation.
A = blkdiag([0.1 0.4; 0.4 0.1],[1 5; 5 1]); B = [1; zeros(3,1)]; C = [1 1 1 1]; D = 0; K = zeros(4,1); x0 = [0.1 0.1 0.1 0.1]; Ts = 0; init_sys = idss(A,B,C,D,K,x0,Ts);
Setting all entries of K
to 0
creates an idss
model with no state disturbance element.
Use the Structure
property to fix the values of some of the model parameters. Configure the model so that B
and K
are fixed, and only the nonzero entries of A
are estimable.
init_sys.Structure.A.Free = (A~=0); init_sys.Structure.B.Free = false; init_sys.Structure.K.Free = false;
The entries in init_sys.Structure.A.Free
determine whether the corresponding entries in init_sys.A
are free (true
) or fixed (false
).
Load the measured data and estimate a statespace model using the parameter constraints and initial values specified by init_sys
.
load iddata2 z2; sys = ssest(z2,init_sys);
The estimated parameters of sys
satisfy the constraints specified by init_sys
.
Consider the Simulink model idF14Model
. Linearizing this model gives a ninthorder model. However, the dynamics of the model can be captured, without compromising the fit quality too much, using a lowerorder model.
Obtain the linearized model.
load_system('idF14Model'); io = getlinio('idF14Model'); sys_lin = linearize('idF14Model',io);
sys_lin
is a ninthorder statespace model with two outputs and one input.
Simulate the step response of the linearized model, and use the data to create an iddata
object.
Ts = 0.0444; t = (0:Ts:4.44)'; y = step(sys_lin,t); data = iddata([zeros(20,2);y],[zeros(20,1); ones(101,1)],Ts);
data
is an iddata
object that encapsulates the step response of sys_lin
.
Compare the data to the model linearization.
compare(data,sys_lin);
Because the data was obtained by simulating the linearized model, there is a 100% match between the data and model linearization response.
Identify a statespace model with a reduced order that adequately fits the data.
Determine an optimal model order.
nx = 1:9; sys1 = ssest(data,nx,'DisturbanceModel','none');
A plot showing the Hankel singular values (SVD) for models of
the orders specified by nx
appears.
States with relatively small Hankel singular values can be safely discarded. The plot suggests using a fifthorder model.
At the MATLAB command prompt, select the model order for
the estimated statespace model. Specify the model order as 5
,
or press Enter to use the default order value.
Compare the data to the estimated model.
compare(data,sys1);
sys1
provides a 98.4% fit for the first output and a 97.7% fit for the second output.
Examine the stopping condition for the search algorithm.
sys1.Report.Termination.WhyStop
ans = 'Maximum number of iterations reached'
Create an estimation options set that specifies the 'lm'
search method and allows a maximum of 50 search iterations.
opt = ssestOptions('SearchMethod','lm'); opt.SearchOption.MaxIter = 50; opt.Display = 'on';
Identify a statespace model using the estimation option set and sys1
as the estimation initialization model.
sys2 = ssest(data,sys1,opt);
Compare the response of the linearized and the estimated models.
compare(data,sys_lin,sys2);
sys2
provides a 99% fit for the first output and a 98% fit for the second output while using 4 less states than sys_lin
.
ssest
initializes the parameter estimates
using a noniterative subspace approach. It then refines the parameter
values using the prediction error minimization approach. See pem
for more information.
[1] Ljung, L. System Identification: Theory For the User, Second Edition, Upper Saddle River, N.J: Prentice Hall, 1999.
canon
 iddata
 idfrd
 idgrey
 idss
 n4sid
 pem
 polyest
 procest
 ssestOptions
 ssregest
 tfest