Documentation Center

  • Trial Software
  • Product Updates

Estimate Model Parameters and Initial States (GUI)

This example shows how to estimate the initial states and parameters of a model.

Loading the Example

To open the Simulink® model of a mass-spring-damper system, type:

msd_system

at the MATLAB® prompt.

This action also loads the two sets of measured data with differing initial conditions.

Model Parameters

The output of the Simulink model, msd_system, is the position of the mass in a mass-spring-damper system. The model is subject to a constant force F, and an initial condition, x0, for the mass displacement. x0 is the initial condition of the integrator block, Position.

The model parameters of interest are the mass, m, the viscous damping, b, and the spring constant, k. For more information about physical modeling of mass-spring-damper systems, see any book on mathematical modeling or on automatic control systems.

For estimating the model parameters m, b, and k, this model uses two experimental data sets. The data sets contain output data measured using two different initial positions, x0=0.1 and x0=0.3, and additive noise.

In the Simulink editor window, select Simulation > Run to run a simulation. The simulation generates the following plots, as shown in the next figure:

  • Simulated response of the model for x0=-0.1 and parameter values, m=8, k=500, and b=100

  • Experimental data sets

The magenta and cyan lines show experimental data with different initial conditions. The yellow line is the model response to a constant force.

Setting Up the Estimation Project

To set up the estimation of initial conditions and then transient state space data, select Analysis > Parameter Estimation in the msd_system model window.

Importing Transient Data and Selecting Parameters for Estimation

To import data for initial state estimation:

  1. In the Control and Estimation Tools Manager, select Transient Data under the Estimation Task node.

  2. Right-click Transient Data, and select New to create a New Data node.

  3. Select New Data under the Transient Data node.

  4. In the Output Data tab of the New Data node, select the Data column of msd_system/Position, and click Import. The Data Import dialog box opens.

    Select yexp1, and click Import to assign the data yexp1 to the model.

  5. In the Output Data pane, select the Time/Ts column of msd_system/Position. In the Data Import dialog box, select texp1, and click Import to assign the time vector texp1 to the model.

  6. Right-click New Data in the Workspace tree, and rename it to Data set #1.

  7. Repeat steps 2–5 to add a second data set, yexp2 and texp2. Rename the data set to Data set #2.

    The Control and Estimation Tools Manager GUI now resembles the next figure.

For more information on importing data, see Import Data (GUI).

Selecting Parameters and Initial Conditions for Estimation

To select the parameters and initial states you want to estimate for the Simulink model msd_system:

  1. Select the Variables node in the Workspace tree of the Control and Estimation Tools Manager GUI.

  2. In the Estimated Parameters pane, click Add to open the Select Parameters dialog box.

  3. Select the parameters b, k, and m, and then click OK. The selected parameters now appear in the Selected parameters area of the Estimated Parameters pane.

  4. In the Estimated States pane, click Add.

    The Select States dialog box opens, which displays all the available states of the msd_system model. Select msd_system/Position, and click OK.

      Note:   For states that you do not estimate, the software uses the initial condition value specified in the Simulink model. In this example, the value of initial velocity, as specified in the model is 0.

    The selected state appears in the Selected states area of the Estimated States pane, as shown in the next figure.

For more information on selecting parameters to estimate, see Specify Parameters to Estimate.

Creating the Estimation Task

To create an estimation task in the Control and Estimation Tools Manager GUI, select the Estimation node in the Workspace tree, and click New. This action creates a New Estimation node.

In the New Estimation node, select the following check boxes:

  • Data Set #1 and Data Set #2 in the Data Sets pane.

  • Estimate for b, k, and m in the Parameters pane.

  • Estimate for Position in the States pane. Make sure to select this check box for both Data Set #1 and Data Set #2 to estimate the initial position for the spring.

Although the initial positions for the two data sets differ, specify the initial state guesses for both data sets as -0.1. The Control and Estimation Tools Manager GUI now resembles the following figure.

Running the Estimation and Viewing Results

Click Start in the Estimation pane to run the estimation.

As the estimation proceeds, the most current estimation of the position response (yellow curve) updates in the Scope. The curve toggles between the two experimental data sets because the software uses the two data sets successively to update the estimates of the parameter values. The software converges to the correct parameter values, within the scope of experimental noise and optimization options settings. The closeness of the estimated response (yellow) to the experimental data (magenta) indicates that simulated data is a good match to the measured data.

View the initial position estimates for Data Set #1 and Data Set #2 in the Value column of the States tab. The estimated values match closely with the known values, 0.1 and 0.3 of initial position.

View the estimated parameter values in the Value column of the Parameters tab.

The estimation of initial states is important for obtaining the correct estimates of the model parameters. You do not set the initial states (x0 in this case) as parameters because the initial states do not represent fixed physical properties of the system. For different experimental data or operating conditions, these states need not be unique.

In this example, you use two data sets with distinct initial positions together for a single estimation of model parameters. While the estimates of the model parameters are unique, the initial state (position) is different, and you estimate them individually for each data set.

Was this topic helpful?