Documentation Center

  • Trial Software
  • Product Updates

Estimate Lookup Table Values from Data

Objectives

This example shows how to estimate lookup table values from time-domain input-output (I/O) data.

About the Data

In this example, you use the I/O data in lookup_regular.mat to estimate the values of a lookup table. The MAT-file includes the following variables:

  • xdata1 — Consists of 63 uniformly-sampled input data points in the range [0,6.5].

  • ydata1 — Consists of output data corresponding to the input data samples.

  • time1 — Time vector.

You use the I/O data to estimate the lookup table values in the lookup_regular Simulink® model. The lookup table in the model contains ten values, which are stored in the MATLAB® variable table. The initial table values comprise a vector of 0s. To learn more about how to model a system using lookup tables, see Guidelines for Choosing a Lookup Table in the Simulink documentation.

Configuring a Project for Parameter Estimation

To estimate the lookup table values, you must first configure a Control and Estimation Tools Manager project.

  1. Open the lookup table model by typing the following command at the MATLAB prompt:

    lookup_regular

    This command opens the Simulink model, and loads the estimation data into the MATLAB workspace.

  2. In the Simulink model, select Analysis > Parameter Estimation to open a new project named lookup_regular in the Control and Estimation Tools Manager GUI.

Estimating the Table Values Using Default Settings

After you configure a project for parameter estimation, as described in Configuring a Project for Parameter Estimation, use the following steps to estimate the lookup table values.

  1. Import the I/O data, xdata1 and ydata1, and the time vector, time1, into the Control and Estimation Tools Manager GUI. For more information, see Import Data (GUI).

    You can also load a preconfigured project that already contains the imported data. To do so, click hereclick here.

  2. Run an initial simulation to view the I/O data, simulated output, and the initial table values. To do so, type the following commands at the MATLAB prompt:

    sim('lookup_regular')
    figure(1); plot(xdata1,ydata1, 'm*', xout, yout,'b^')
    hold on; plot(linspace(0,6.5,10), table, 'k', 'LineWidth', 2);
    legend('Measured data','Initial simulation data','Initial table values');

    The x- and y-axes of the figure represent the input and output data, respectively.

  3. Select the table values to estimate.

    1. In the Control and Estimation Tools Manager GUI, select the Variables node under the Estimation Task node.

    2. Click Add to open the Select Parameters dialog box, which shows the Simulink model parameters.

    3. Select table, and click OK to add the table values to the Estimated Parameters tab.

      The Default settings area of the GUI displays the default settings for the table values. The Value field displays the initial table values, which comprise a vector of ten 0s.

    4. Select the Estimation node, and click New to add a New Estimation node.

    5. Select the New Estimation node. In the Parameters tab, select the Estimate check box to specify the lookup table values, table, for estimation.

  4. In the Data Sets tab of the New Estimation node, select the Selected check box to specify the estimation data set.

  5. Estimate the table values using the default settings.

    1. In the Estimation tab of the New Estimation node, click Start to start the estimation.

      The Control and Tools Manager GUI updates at each iteration, and provides information about the estimation progress. After the estimation completes, the Control and Estimation Tools Manager GUI looks similar to the following figure.

    2. Select the Parameters tab in the New Estimation node to view the estimated table values, which appear in the Value field.

Validating the Estimation Results

After you estimate the table values, as described in Estimating the Table Values Using Default Settings, you must use another data set to validate that you have not overfitted the model. You plot and examine the following plots to validate the estimation results:

  • Residuals plot

  • Measured and simulated data plots

To validate the estimation results:

  1. Import the validation I/O data, xdata2 and ydata2, and time vector, time2, in the Control and Estimation Tools Manager GUI.

    You can also load a project that already contains the estimated parameters, and the validation data set. To do so, click hereclick here.

    This project also contains the Residuals plot already configured in the Select plot types area of the GUI, as shown in the next figure. For more information on how to configure this plot, see Compare Measured and Simulated Responses.

  2. Plot and examine the residuals:

    1. Select the New Validation node under the Validation node.

    2. In the Options area, select Validation Data from the Validation data set drop-down list.

    3. Click Show Plots to open the residuals plot.

      The residuals, which show the difference between the simulated and measured data, lie in the range [-0.15,0.15]— within 15% of the maximum output variation. This indicates a good match between the measured and the simulated table data values.

    4. Plot and examine the estimated table values against the validation data set and the simulated table values by typing the following commands at the MATLAB prompt.

      sim('lookup_regular')
      figure(2); plot(xdata2,ydata2, 'm*', xout, yout,'b^')
      hold on; plot(linspace(0,6.5,10), table, 'k', 'LineWidth', 2)

      The plot shows that the table values, displayed as the black line, match both the validation data and the simulated table values. The table data values cover the entire range of input values, which indicates that all the lookup table values have been estimated.

Was this topic helpful?