Skip to Main Content Skip to Search
Product Documentation

Refining Linear Parametric Models

When to Refine Models

There are two situations where you can refine estimates of linear parametric models.

In the first situation, you have already estimated a parametric model and wish to update the values of its free parameters to improve the fit to the estimation data. This is useful if your previous estimation terminated because of search algorithm constraints such as maximum number of iterations or function evaluations allowed reached. However, if your model captures the essential dynamics, it is usually not necessary to continue improving the fit—especially when the improvement is a fraction of a percent.

In the second situation, you might have constructed a model using one of the model constructors described in Commands for Constructing Model Structures. In this case, you built initial parameter guesses into the model structure and wish to refine these parameter values.

What You Specify to Refine a Model

When you refine a model, you must provide two inputs:

How to Refine Linear Parametric Models in the GUI

The following procedure assumes that the model you want to refine is already in the System Identification Tool GUI. You might have estimated this model in the current session or imported the model from the MATLAB workspace. For information about importing models into the GUI, see Importing Models into the GUI.

To refine your model:

  1. In the System Identification Tool GUI, verify that you have the correct data set in the Working Data area for refining your model.

    If you are using a different data set than the one you used to estimate the model, drag the correct data set into the Working Data area. For more information about specifying estimation data, see Specifying Estimation and Validation Data.

  2. Select Estimate > Polynomial Models or Estimate > State Space Models to open the Polynomial and State Space Models dialog box, if this dialog box is not already open.

  3. In the Linear Parametric Models dialog box, select By Initial Model from the Structure list.

  4. Enter the model name into the Initial model field, and press Enter.

    The model name must be in the Model Board of the System Identification Tool GUI or a variable in the MATLAB workspace. This model need not be a state-space or polynomial model; it could also be a process model (idproc) or a transfer function model (idtf).

      Tip   As a shortcut for specifying a model in the Model Board, you can drag the model icon from the System Identification Tool GUI into the Initial model field.

    When you enter the model name, algorithm settings in the Polynomial and State Space Models dialog box override the initial model settings.

  5. Modify the iteration options, displayed in the Polynomial and State Space Models dialog box, if necessary.

  6. Click Estimate to refine the model.

  7. Validate the new model, as described in Model Analysis.

How to Refine Linear Parametric Models at the Command Line

If you are working at the command line, you can use pem to refine parametric model estimates. You can also use the various model-structure specific estimators - ssest for idss models, polyest for idpoly models, tfest for idtf models, and greyest for idgrey models.

The general syntax for refining initial models is as follows:

m = pem(data,init_model)

pem uses the properties of the initial model.

You can also specify the estimation options configuring the objective function and search algorithm settings. For more information, see the reference page of the estimating function.

Example – Refining an Initial ARMAX Model at the Command Line

The following example shows to estimate an initial model and try to refine this model using pem:

load iddata8

% Split the data z8 into two parts.
% Create new data object with first hundred samples
z8a = z8(1:100);

% Create new data object with remaining samples
z8b = z8(101:end); 

% Estimate ARMAX model with default Algorithm
% properties, na=4, nb=[3 2 3], nc=2, and nk=[0 0 0]
m1 = armax(z8a,[4 3 2 3 2 0 0 0]);

% Refine the initial model m1 using the data set z8b,
% and stricter algorithm settings with increased number
% of maximum iterations (MaxIter) and smaller tolerance
opt = armaxOptions;
opt,SearchOption.Tolerance = 1e-5;
opt.SearchOption.MaxIter = 50;
m2 = pem(z8b,m1,opt)

% You can replace "pem" with "polyest" or "armax" and get the same results.

For more information about estimating polynomial models, see Identifying Input-Output Polynomial Models.

Example – Refining an ARMAX Model with Initial Parameter Guesses at the Command Line

The following example shows how to refine models for which you have initial parameter guesses. This example estimates an ARMAX model for the data and requires you to initialize the A, B, and C polynomials.

In this case, you must first create a model object and set the initial parameter values in the model properties. Next, you provide this initial model as input to armax, polyest, or pem, which refine the initial parameter guesses using the data.

load iddata8
% Define model parameters.
% Leading zeros in B indicate input delay (nk),
% which is 1 for each input channel.
A = [1 -1.2 0.7];
B{1} = [0 1 0.5 0.1]; % first input
B{2} = [0 1.5 -0.5]; % second input
B{3} = [0 -0.1 0.5 -0.1]; % third input
C = [1 0 0 0 0];
Ts = 1;

% Create model object.
init_model = idpoly(A,B,C,'Ts',1);

% Use polyest to update the parameters of the initial model.
model = polyest(z8,init_model)

% Compare the two models.
compare(z8,init_model,model)

For more information about estimating polynomial models, see Identifying Input-Output Polynomial Models.

  


Free Control Systems Interactive Kit

Learn more about resources for designing, testing, and implementing control systems.

Get free kit

Trials Available

Try the latest control systems products.

Get trial software
 © 1984-2012- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS