Main Content

估计查找表的约束值

目标

此示例显示了如何估计查找表的约束值参数估计器。Apply monotonically increasing constraints to the lookup table output values, and use the参数估计器估计表值。

关于数据

在此示例中,使用Lookup_increasing.mat,其中包含用于估计查找表值的测得的I/O数据。垫子文件包括以下变量:

  • XDATA1- 由602个均匀采样的数据点组成的输入数据[-5,5]

  • YDATA1- 输出数据对应于输入数据样本。

  • time1- 时间向量。

Use the I/O data to estimate monotonically increasing output values of the lookup table in theLookup_increasing万博1manbetx®模型。

查找表输出

  1. 打开the lookup table model by typing the following command at the MATLAB®迅速的:

    Lookup_increasing

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

  2. 通过双击查看表输出值Lookup Table堵塞。

    这table contains 11 output values at breakpoints[-5:5],在功能块参数对话框中指定。要了解有关如何指定表值的更多信息,请参见Enter Breakpoints and Table Data

    Table datafield shows that the table output values are the cumulative sum of the values stored in variableYdelta。Thus, ifynare the 11 table output values,Ydelta是 (y1,,,,y2-y1,,,,y3-y2,...,,y11-y10)。这initialYdeltavalues are loaded fromLookup_increasing.mat

    初始表输出值并非单调增加。为了确保单调增加表输出值,相邻表输出值之间的差异应为正。为此,估计Ydeltain the参数估计器using the measured I/O estimation data, and constrainYdelta(2:end)to be positive during estimation.

使用默认设置估算单调增加的表值

  1. 打开参数估计会话。

    在Simuli万博1manbetxnk模型中,选择参数估计器from the应用标签,在画廊,下面控制系统打开名称的会话Lookup_increasingin the参数估计器

  2. 创建一个实验和import the I/O data.

    Parameter Estimation选项卡,单击New Experiment。类型[Time1,Ydata1]in输出and[time1,xdata1]in输入编辑实验对话框。点击OK。A new experiment with nameExp是在实验area of the app. Rename the experiment估计Data通过右键单击默认实验名称,Exp,选择改名。有关更多信息,请参阅Import Data for Parameter Estimation

  3. 运行初始仿真以通过在MATLAB提示符下键入以下命令来查看测量数据,模拟模型值和初始表值。

    sim('lookup_increasing') 图1);绘图(xdata1,ydata1,'M*',,,,xout,yout,'b^')holdon; plot(-5:5,cumsum(ydelta),'k',,,,'行宽',2)Xlabel('输入数据');ylabel('Output Data');legend(“测量数据”,,,,'Initial simulated data',,,,“初始表输出”

    初始表输出值和模拟数据与测量数据不匹配。

  4. 选择parameter for estimation.

    Parameter Estimation选项卡,单击选择参数。编辑:估计参数对话框打开。在里面调整所有实验的参数panel, click选择参数to open the Select Model Variables dialog box. Check the box next toYdelta,然后单击OK

    Ydeltavalues are selected for estimation by default in the Edit: Estimated Parameters dialog box.

  5. Apply a monotonically increasing constraint on the table output values. For more details about the table, see查找表输出

    在“编辑:估计参数”对话框中,单击旁边的箭头Ydelta值。在扩展的菜单中,设置MinimumYdelta值为[-inf,零(1,10)]。Thus, while the first value inYdeltacan by anything, subsequent values which are the difference between adjacent table output values, must be positive.

  6. 选择估计Data实验进行估计。

    Parameter Estimation选项卡,单击选择Experiment。默认,估计Data选择进行估计。如果没有,请选中该框估计column, and clickOK

  7. 估计the table values using default settings.

    Parameter Estimation选项卡,单击估计

    参数轨迹图显示了每次迭代处的参数值的变化。

    估计进度报告显示了评估目标函数的迭代编号,评估目标函数的次数以及每次迭代末尾的成本函数的值。

    估计的参数保存在新变量中,估计值,,,,in theResultsarea of the app. To view the estimated parameters, right-click估计值并选择打开

    估计Ydelta(2:end)值是正的。因此,表的输出是存储在中的值的累积总和Ydelta,单调增加。

验证估计结果

After you estimate the table values, as described in使用默认设置估算单调增加的表值,,,,you use another measured data set to validate and check that you have not over-fit the model. You can plot and examine the following plots to validate the estimation results:

  • 残差图

  • 测量和模拟数据图

  1. 创建一个实验,用于验证并导入验证I/O数据。

    Parameter Estimation选项卡,单击New Experiment。类型[time2,ydata2]in输出and[TIME2,XDATA2]in输入编辑实验对话框。命名实验验证数据通过右键单击默认实验名称,Exp,,,,in the实验area of the app, and selecting改名。有关更多信息,请参阅Import Data for Parameter Estimation

  2. 选择实验进行验证。

    点击选择实验on theParameter Estimation标签。这验证数据experiment is selected for estimation by default. Clear估计并选择the box for验证

  3. 选择要验证的结果。

    验证选项卡,单击选择Results to Validate。清除使用当前参数值, 选择估计值,然后单击OK

  4. 在验证期间选择要显示的图。

    参数估计器默认情况下验证后显示实验图。通过选择“相应框”上的添加残差图验证标签。

    点击证实

  5. 检查图。

    1. 这experiment plot shows the data simulated using estimated parameters agrees with the measured validation data.

    2. 要查看残差图,请单击剩余图:验证数据标签。

      这residuals, which show the difference between the simulated and measured data, lie within 15% of the maximum output variation. This indicates a good match between the measured and simulated table data values.

    3. 绘制并检查验证数据,模拟数据和估计的表值。

      sim('lookup_increasing')图(2);绘图(xdata2,ydata2,'M*',,,,xout,yout,'b^')holdon; plot(-5:5,cumsum(ydelta),'k',,,,'行宽',,,,2)xlabel('输入数据');ylabel('Output Data');legend(“验证数据”,,,,'Simulated data',,,,'Table output values');

      这table output values match both the measured data and the simulated table values. The table output values cover the entire range of input values, which indicates that all the lookup table values have been estimated.

Related Topics