| Contents | Index |
sys = pem(data,init_sys)
sys = pem(data,init_sys,opt)
sys = pem(data,init_sys) updates the parameters of init_sys, a linear or nonlinear model, to fit the given estimation data, data. The prediction error minimization algorithm is used to update the free parameters of init_sys.
sys = pem(data,init_sys,opt) configures the estimation options using the option set opt. This syntax is valid for linear models only.
data |
Estimation data. Specify data as an iddata or idfrd object containing the measured input/output data. The input-output dimensions of data and init_sys must match. You can specify frequency-domain data only when init_sys is a linear model. | ||||||||||||
init_sys |
Linear or nonlinear identified model that configures the initial parameterization of sys. init_sys may be a linear or nonlinear model and must have finite parameter values. You may obtain init_sys by performing an estimation using measured data, or by direct construction. idnlarx and idnlhw models can be obtained only by estimation. You can configure initial guesses, specify minimum/maximum bounds, and fix or free for estimation any parameter of init_sys.
| ||||||||||||
opt |
Estimation options. opt is an option set that specifies:
You can specify an option set only when init_sys is a linear model. You must create an option set using one of the following functions. The function used to create the option set depends on the initial model type.
|
sys |
Identified model. sys is obtained by estimating the free parameters of init_sys using the prediction error minimization algorithm. |
Estimate a discrete-time state-space model using the subspace method and refine it by minimizing the prediction error.
Estimate a discrete-time state-space model using n4sid, which applies the subspace method.
load iddata7 z7; z7a = z7(1:300); opt = n4sidOptions('Focus','simulation'); init_sys = n4sid(z7a,4,opt);
init_sys, the estimated state-space model, provides a 73.85% fit to the estimation data (see init_sys.Report.Fit.FitPercent). Use pem to improve the closeness of the fit.
Obtain a refined estimated model by using pem.
sys = pem(z7a,init_sys);
Analyze the results.
compare(z7a,sys,init_sys);

sys refines the estimated model and provides a 74.54% fit to the estimation data (see init_sys.Report.Fit.FitPercent).
Create a process model structure and update its parameter values to minimize prediction error.
Create a process model and initialize its coefficients.
init_sys = idproc('P2UDZ');
init_sys.Kp = 10;
init_sys.Tw = 0.4;
init_sys.Zeta = 0.5;
init_sys.Td = 0.1;
init_sys.Tz = 0.01;Use init_sys, a process model created by direct construction, to configure the estimation by pem. The Kp, Tw, Zeta, Td and Tz coefficients of init_sys are configured with their initial guesses.
Estimate a prediction error minimizing model using measured data.
load iddata1 z1; opt = procestOptions('Display','on','SearchMethod','lm'); sys = pem(z1,init_sys,opt);
As init_sys is an idproc model, use the corresponding option set command, procestOptions to create an estimation configuring option set. The estimation is set to use the Levenberg-Marquardt search method ('SearchMethod','lm') and will display the iterative search results during estimation ('Display','on').
sys is an estimated process model, which provides a 70.63% fit to the measured data (see sys.Report.Fit.FitPercent).
Estimate the parameters of a nonlinear grey box model to fit DC motor data.
Load the experimental data, and specify the signal attributes such as start time, and units.
load(fullfile(matlabroot, 'toolbox', 'ident', 'iddemos', 'data', 'dcmotordata')); data = iddata(y, u, 0.1); set(data,'Tstart',0,'TimeUnit','s');
Configure the nonlinear grey-box model (idnlgrey) model.
For this example, use the shipped file dcmotor_m.m. To view this file, enter edit dcmotor_m.m at the MATLAB command prompt.
file_name = 'dcmotor_m'; order = [2 1 2]; parameters = [1; 0.28]; initial_states = [0; 0]; Ts = 0; init_sys = idnlgrey(file_name,order,parameters,initial_states,Ts); set(init_sys,'TimeUnit','s'); setinit(init_sys,'Fixed',{false false});
init_sys is a nonlinear grey-box model with its structure described by dcmotor_m.m. The model has one input, two outputs and two states, as specified by order.
setinit(init_sys,'Fixed',{false false}) specifies that the initial states of init_sys are free estimation parameters.
Estimate the model parameters and initial states.
sys = pem(data,init_sys);
sys is an idnlgrey model, which encapsulates the estimated parameters and their covariance.
Analyze the estimation result.
compare(data,sys,init_sys);

sys provides a 98.34% fit to the estimated data.
PEM uses numerical optimization to minimize the cost function, a weighted norm of the prediction error, defined as follows for scalar outputs:
![]()
where e(t) is the difference between the measured output and the predicted output of the model. For a linear model, this error is defined by the following equation:
![]()
e(t) is a vector and the cost function
is a scalar value. The subscript N indicates
that the cost function is a function of the number of data samples
and becomes more accurate for larger values of N.
For multiple-output models, the previous equation is more complex.
You can use model type specific estimation commands for all model types, except for idnlgrey models. These commands achieve the same results as pem when an initial model of matching type is provided as input argument. The following table summarizes the dedicated estimation commands for each model type.
| Function | Model Type |
|---|---|
| ssest | idss |
| tfest | idtf |
| polyest | idpoly |
| procest | idproc |
| greyest | idgrey |
| nlarx | idnlarx |
| nlhw | idnlhw |
armax | bj | compare | greyest | greyestOptions | iddata | idfilt | idfrd | idgrey | idpoly | idproc | idss | idtf | n4sid | nlarx | nlhw | oe | polyestOptions | procest | procestOptions | resid | ssest | ssestOptions | tfest | tfestOptions

Learn more about resources for designing, testing, and implementing control systems.
Get free kit| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |