【问题标题】:How to use aryule() in Matlab to extend a number series?如何在 Matlab 中使用 aryule() 来扩展数列?
【发布时间】:2023-03-11 05:15:02
【问题描述】:

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

但是现在我该如何扩展这个系列呢?

整个工作如下:

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 使用:

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())也可以......这就是我所做的,如果你有更好的想法,请告诉我!]

【问题讨论】:

  • 所以数据本质上就是您在 (a) 中发布的向量?

标签: matlab time-series linear-regression


【解决方案1】:

对于长度为 N 的实值序列 x 和正阶 p:

coeff = aryule(x, p)

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

x(N+1) = sum_[k=0:p] ( coeff(k)*x(N-k) )

或在实际的 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 = m.a;
nextValue = pred(end);

subplot(121), plot(data)
subplot(122), plot( cell2mat(pred) )

【讨论】:

    【解决方案2】:

    您的数据具有非零均值。 Yule-Walker 模型不是假设数据是由零均值白噪声过程激发的线性滤波器的输出吗?

    如果你去掉平均值,this example 使用 ARYULE 和 LPC 可能就是你要找的东西。该过程归结为:

    a = lpc(data,9); % uses Yule-Walker modeling
    pred = filter(-a(2:end),1,data);
    disp(pred(end)); % the predicted value at time N+1
    

    【讨论】:

      猜你喜欢
      • 2014-07-19
      • 2016-02-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-10-15
      • 1970-01-01
      • 1970-01-01
      • 2011-08-22
      相关资源
      最近更新 更多