Main Content

Estimate Discrete-Time Grey-Box Model with Parameterized Disturbance

This example shows how to create a single-input and single-output grey-box model structure when you know the variance of the measurement noise. The code in this example uses the Control System Toolbox™ commandkalman(Control System Toolbox)for computing the Kalman gain from the known and estimated noise variance.

Description of the SISO System

This example is based on a discrete, single-input and single-output (SISO) system represented by the following state-space equations:

x ( k T + T ) = [ p a r 1 p a r 2 1 0 ] x ( k T ) + [ 1 0 ] u ( k T ) + w ( k T ) y ( k T ) = [ p a r 3 p a r 4 ] x ( k T ) + e ( k T ) x ( 0 ) = x 0

wherewandeare independent white-noise terms with covariance matricesR1andR2, respectively.R1=E{ww'} is a 2–by-2 matrix andR2=E{ee'} is a scalar.par1,par2,par3, and标准杆4杆represent the unknown parameter values to be estimated.

Assume that you know the variance of the measurement noiseR2to be 1.R1(1,1) is unknown and is treated as an additional parameterpar5. The remaining elements ofR1are known to be zero.

Estimating the Parameters of an idgrey Model

You can represent the system described inDescription of the SISO Systemas anidgrey(grey-box) model using a function. Then, you can use this file and thegreyestcommand to estimate the model parameters based on initial parameter guesses.

To run this example, you must load an input-output data set and represent it as aniddataoridfrdobject calleddata. For more information about this operation, seeRepresenting Time- and Frequency-Domain Data Using iddata ObjectsorRepresenting Frequency-Response Data Using idfrd Objects.

To estimate the parameters of a grey-box model:

  1. Create the filemynoisethat computes the state-space matrices as a function of the five unknown parameters and the auxiliary variable that represents the known varianceR2. The initial conditions are not parameterized; they are assumed to be zero during this estimation.

    Note

    R2is treated as an auxiliary variable rather than assigned a value in the file to let you change this value directly at the command line and avoid editing the file.

    function[A,B,C,D,K] = mynoise(par,T,aux) R2 = aux(1);% Known measurement noise varianceA = [par(1) par(2);1 0]; B = [1;0]; C = [par(3) par(4)]; D = 0; R1 = [par(5) 0;0 0]; [~,K] = kalman(ss(A,eye(2),C,0,T),R1,R2);
  2. Specify initial guesses for the unknown parameter values and the auxiliary parameter valueR2:

    par1 = 0.1;% Initial guess for A(1,1)par2 = -2;% Initial guess for A(1,2)par3 = 1;% Initial guess for C(1,1)标准杆4杆= 3;% Initial guess for C(1,2)par5= 0.2;% Initial guess for R1(1,1)Pvec = [par1; par2; par3; par4; par5] auxVal = 1;% R2=1
  3. Construct anidgreymodel using themynoisefile:

    Minit = idgrey(“mynoise”,Pvec,'d',auxVal);

    The third input argument'd'specifies a discrete-time system.

  4. Estimate the model parameter values from data:

    opt = greyestOptions; opt.InitialState ='zero'; opt.Display ='full'; Model = greyest(data,Minit,opt)

See Also

(Control System Toolbox)||

Related Examples

More About