Documentation Center

  • Trial Software
  • Product Updates


Linear grey-box model estimation


sys = greyest(data,init_sys)
sys = greyest(data,init_sys,opt)


sys = greyest(data,init_sys) estimates a linear grey-box model, sys, using time or frequency domain data, data. The dimensions of the inputs and outputs of data and init_sys, an idgrey model, must match. sys is an identified idgrey model that has the same structure as init_sys.

sys = greyest(data,init_sys,opt) estimates a linear grey-box model using the option set, opt, to configure the estimation options.

Input Arguments


Estimation data.

The dimensions of the inputs and outputs of data and init_sys must match.

For time-domain estimation, data is an iddata object containing the input and output signal values.

For frequency domain estimation, data can be one of the following:

  • Recorded frequency response data (frd or idfrd)

  • iddata object with its Domain property set to 'Frequency'


Identified linear grey-box model that configures the initial parameterization of sys.

init_sys, an idgrey model, must have the same input and output dimensions as data.


Estimation options.

opt is an option set, created using greyestOptions, which specifies options including:

  • Estimation objective

  • Initialization choice

  • Disturbance model handling

  • Numerical search method to be used in estimation

Output Arguments


Estimated linear grey-box model.

sys is an idgrey model that encapsulates the estimated linear grey-box model.


expand all

Estimate Grey-Box Model

Estimate the parameters of a DC motor using the linear grey-box framework.

Load the measured data.

load(fullfile(matlabroot, 'toolbox', 'ident', ...
					'iddemos', 'data', 'dcmotordata'));
data = iddata(y, u, 0.1, 'Name', 'DC-motor');
set(data, 'InputName', 'Voltage', 'InputUnit', 'V');
set(data, 'OutputName', {'Angular position', 'Angular velocity'});
set(data, 'OutputUnit', {'rad', 'rad/s'});
set(data, 'Tstart', 0, 'TimeUnit', 's');

data is an iddata object containing the measured data for the outputs, the angular position, the angular velocity. It also contains the input, the driving voltage.

Create a grey-box model representing the system dynamics.

For the DC motor, choose the angular position (rad) and the angular velocity (rad/s) as the outputs and the driving voltage (V) as the input. Set up a linear state-space structure of the following form:

$$ \dot {x}(t) =  \left [ \matrix{0 & 1 \cr
0& -\frac{1}{\tau}\cr }\right]x(t) + \left [ \matrix{0\cr \frac{G}{\tau}\cr} \right]u(t)$$

$$ y(t) =  \left [ \matrix{1 & 0 \cr
0& 1\cr }\right]x(t).$$

$\tau$ is the time constant of the motor in seconds, and $G$ is the static gain from the input to the angular velocity in rad/(V*s) .

G = 0.25;
tau = 1;

init_sys = idgrey('motor',tau,'cd',G,0);

The governing equations in state-space form are represented in the MATLAB® file motor.m. To view the contents of this file, enter edit motor.m at the MATLAB command prompt.

$G$ is a known quantity that is provided to motor.m as an optional argument.

$\tau$ is a free estimation parameter.

init_sys is an idgrey model associated with motor.m.

Estimate $\tau$ .

sys = greyest(data,init_sys);

sys is an idgrey model containing the estimated value of $\tau$ .

To obtain the estimated parameter values associated with sys, use getpvec(sys).

Analyze the result.

opt = compareOptions('InitialCondition','zero');

sys provides a 98.35% fit for the angular position and an 84.42% fit for the angular velocity.

Estimate Grey-Box Model Using Regularization

Estimate the parameters of a DC motor by incorporating prior information about the parameters when using regularization constants.

The model is parameterized by static gain G and time constant τ. From prior knowledge, it is known that G is about 4 and τ is about 1. Also, you have more confidence in the value of τ than G and would like to guide the estimation to remain close to the initial guess.

Load estimation data.

load regularizationExampleData.mat motorData;

The data contains measurements of motor's angular position and velocity at given input voltages.

Create idgrey model for DC motor dynamics.

type DCMotorODE.m 
mi = idgrey(@DCMotorODE,{'G', 4; 'Tau', 1},'cd',{}, 0);
mi = setpar(mi, 'label', 'default'); 

Specify regularization options Lambda.

opt = greyestOptions;
opt.Regularization.Lambda = 100;

Specify regularization options R.

opt.Regularization.R = [1, 1000]; 

You specify more weighting on the second parameter because you have more confidence in the value of τ than G.

Specify the initial values of the parameters as regularization option θ*.

opt.Regularization.Nominal = 'model';

Estimate the regularized grey-box model.

sys = greyest(motorData, mi, opt);

See Also

| | | | | |

Was this topic helpful?