MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   资料存档 (https://www.labfans.com/bbs/forumdisplay.php?f=72)
-   -   如何在Matlab中使用aryule()扩展数字序列? (https://www.labfans.com/bbs/showthread.php?t=22797)

poster 2019-12-10 16:49

如何在Matlab中使用aryule()扩展数字序列?
 
我有一系列数字。我使用[B][URL="http://www.mathworks.com/access/helpdesk/help/toolbox/signal/index.html?/access/helpdesk/help/toolbox/signal/aryule.html"]Yule-Walker方法[/URL][/B]计算了它们之间的[B]“自回归”[/B] 。

[B]但是现在如何扩展该系列?[/B]

整个工作如下:

a)我使用的系列:
[INDENT] 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

[/INDENT]b)使用以下方法将该数据加载到[B]数据[/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) [B]现在使用这个,如何计算序列中的下一个数字?[/B]

[执行此操作的任何其他方法(使用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)';
[B]编辑:[/B]如果您可以访问[I]System Identification Toolbox[/I] ,则可以使用许多函数中的任何一种来估计AR / ARMAX模型( [B]ar[/B] / [B]arx[/B] / [B]armax[/B] )(甚至可以使用[B]selstruc[/B]查找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) )

[url=https://stackoverflow.com/questions/1493621]更多&回答...[/url]


所有时间均为北京时间。现在的时间是 23:16

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.