查看单个帖子
旧 2019-12-10, 16:49   #1
poster
高级会员
 
注册日期: 2019-11-21
帖子: 3,006
声望力: 66
poster 正向着好的方向发展
帖子 如何在Matlab中使用aryule()扩展数字序列?

我有一系列数字。我使用Yule-Walker方法计算了它们之间的“自回归”

但是现在如何扩展该系列?

整个工作如下:

a)我使用的系列:
143.85 141.95 141.45 142.30 140.60 140.00 138.40 137.10 138.90 139.85 138.75 139.85 141.30 139.45 140.15 140.80 142.50 143.00 142.35 143.00 142.55 140.50 141.25 140.55 141.45 142.05

b)使用以下方法将该数据加载到数据中:

data = load('c:\\input.txt', '-ascii'); c)系数的计算:

ar_coeffs = aryule(data,9); 这给出了:

ar_coeffs = 1.0000 -0.9687 -0.0033 -0.0103 0.0137 -0.0129 0.0086 0.0029 -0.0149 0.0310 d) 现在使用这个,如何计算序列中的下一个数字?

[执行此操作的任何其他方法(使用aryule()除外)也可以...这是我所做的,如果您有更好的主意,请告诉我!]


回答:
对于长度为N且正序为p的实值序列x:

coeff = aryule(x, p) 返回数据x的p阶AR系数(请注意coeff(1)是归一化因子)。换句话说,它将值建模为过去的p值的线性组合。因此,为了预测下一个值,我们将最后的p个值用作:

x(N+1) = sum_[k=0:p] ( coeff(k)*x(Nk) ) 或在实际的MATLAB代码中:

p = 9; data = [...]; % the seq you gave coeffs = aryule(data, p); nextValue = -coeffs(2:end) * data(end:-1:end-p+1)';
编辑:如果您可以访问System Identification Toolbox ,则可以使用许多函数中的任何一种来估计AR / ARMAX模型( ar / arx / armax )(甚至可以使用selstruc查找AR模型的顺序):

m = ar(data, p, 'yw'); % yw for Yule-Walker method pred = predict(m, data, 1); coeffs = ma; nextValue = pred(end); subplot(121), plot(data) subplot(122), plot( cell2mat(pred) )

更多&回答...
poster 当前离线   回复时引用此帖