使用 armax 估计模型
本示例演示了如何使用迭代估计方法 armax,对一个三输入单输出 (MISO) 系统中的具有 ARMAX 结构的线性多项式模型进行估计。有关该工具箱中所有可用估计命令的摘要,请参阅模型估计命令。
加载一个名为 z8 的样本数据集,该数据集包含三个输入和一个输出,测量间隔为 1 秒,共包含 500 个数据样本。
load iddata8使用 armax 既可构建 idpoly 模型对象,也可估计参数:
.
通常,您会尝试不同的模型阶数并比较结果,最终选择能够最好地描述系统动态特性的最简单模型。以下命令指定了估计数据集 z8,并将 A、B 和 C 多项式的阶分别设为 na、nb 和 nc。nk 中的 [0 0 0] 指定三个输入通道均不存在输入延迟。
opt = armaxOptions;
opt.Focus = 'simulation';
opt.SearchOptions.MaxIterations = 50;
opt.SearchOptions.Tolerance = 1e-5;
na = 4;
nb = [3 2 3];
nc = 4;
nk = [0 0 0];
m_armax = armax(z8, [na nb nc nk], opt);Focus、Tolerance 和 MaxIter 是用于配置估计目标函数和搜索算法属性的估计选项。Focus 选项用于指定该模型是针对仿真还是预测应用进行优化的。搜索选项 Tolerance 和 MaxIter 用于指定何时停止估计。有关这些属性的更多信息,请参阅 armaxOptions 参考页面。
armax 是 polyest 的一个版本,其 ARMAX 模型结构的语法经过了简化。armax 方法既构建 idpoly 模型对象,又对其参数进行估计。
查看生成的模型对象的相关信息。
m_armax
m_armax =
Discrete-time ARMAX model: A(z)y(t) = B(z)u(t) + C(z)e(t)
A(z) = 1 - 1.284 z^-1 + 0.3048 z^-2 + 0.2648 z^-3 - 0.05708 z^-4
B1(z) = -0.07547 + 1.087 z^-1 + 0.7166 z^-2
B2(z) = 1.019 + 0.1142 z^-1
B3(z) = -0.06739 + 0.06828 z^-1 + 0.5509 z^-2
C(z) = 1 - 0.06096 z^-1 - 0.1296 z^-2 + 0.02489 z^-3 - 0.04699 z^-4
Sample time: 1 seconds
Parameterization:
Polynomial orders: na=4 nb=[3 2 3] nc=4 nk=[0 0 0]
Number of free coefficients: 16
Use "polydata", "getpvec", "getcov" for parameters and their uncertainties.
Status:
Estimated using ARMAX on time domain data "z8".
Fit to estimation data: 80.86% (simulation focus)
FPE: 2.888, MSE: 0.9868
Model Properties
m_armax 是一个 idpoly 模型对象。这些系数代表了该多项式模型的估计参数。您可以使用 present(m_armax) 来显示有关该模型的更多信息,包括参数的不确定性。
查看此模型的所有属性值。
get(m_armax)
A: [1 -1.2836 0.3048 0.2648 -0.0571]
B: {[-0.0755 1.0870 0.7166] [1.0188 0.1142] [-0.0674 0.0683 0.5509]}
C: [1 -0.0610 -0.1296 0.0249 -0.0470]
D: 1
F: {[1] [1] [1]}
IntegrateNoise: 0
Variable: 'z^-1'
IODelay: [0 0 0]
Structure: [1×1 pmodel.polynomial]
NoiseVariance: 2.7984
InputDelay: [3×1 double]
OutputDelay: 0
InputName: {3×1 cell}
InputUnit: {3×1 cell}
InputGroup: [1×1 struct]
OutputName: {'y1'}
OutputUnit: {''}
OutputGroup: [1×1 struct]
Notes: [0×1 string]
UserData: []
Name: ''
Ts: 1
TimeUnit: 'seconds'
SamplingGrid: [1×1 struct]
Report: [1×1 idresults.polyest]
Report 模型属性包含有关估计结果的详细信息。要查看 Report 中的属性和值,请使用点表示法。例如:
m_armax.Report
ans =
Status: 'Estimated using ARMAX with simulation focus'
Method: 'ARMAX'
InitialCondition: 'zero'
Fit: [1×1 struct]
Parameters: [1×1 struct]
OptionsUsed: [1×1 idoptions.polyest]
RandState: [1×1 struct]
DataUsed: [1×1 struct]
Termination: [1×1 struct]
此操作将显示估计报告的内容,例如模型质量指标 (Fit)、搜索终止条件 (Termination)、估计数据记录 (DataUsed) 以及选项 (OptionsUsed)。