如何在Matlab中使用aryule()扩展数字序列? [英] How to use aryule() in Matlab to extend a number series?

查看:753
本文介绍了如何在Matlab中使用aryule()扩展数字序列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一系列数字.我使用

I have a series of numbers. I calculated the "auto-regression" between them using 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)使用以下方法将此数据加载到数据:

b) this data is loaded in to data using:

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()除外)也可以...这是我所做的,如果您有更好的主意,请告诉我!]

[any other method of doing this (except using aryule()) is also fine... this is what I did, if you have a better idea, please let me know!]

推荐答案

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

For a real valued sequence x of length N, and a positive order p:

coeff = aryule(x, p)

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

returns the AR coefficients of order p of the data x (Note that coeff(1) is a normalizing factor). In other words it models values as a linear combination of the past p values. So to predict the next value, we use the last p values as:

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

或在实际的MATLAB代码中:

or in actual MATLAB code:

p = 9;
data = [...];      % the seq you gave
coeffs = aryule(data, p);
nextValue = -coeffs(2:end) * data(end:-1:end-p+1)';


编辑:如果您可以访问系统标识工具箱,则可以使用多种功能中的任何一种来估算AR/ARMAX模型( ar / arx / armax )(甚至使用 selstruc 查找AR模型的顺序):


If you have access to System Identification Toolbox, then you can use any of a number of functions to estimate AR/ARMAX models (ar/arx/armax) (or even find the order of AR model using selstruc):

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) )

这篇关于如何在Matlab中使用aryule()扩展数字序列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆