【发布时间】:2014-12-23 14:27:24
【问题描述】:
我有一个包含 N 个太阳黑子数据点的时间序列,我想根据这些点的子集预测该系列中的剩余点,然后比较正确性。
我刚刚开始使用 Matlab 进行线性预测,因此我决定在循环中使用以下代码段,以便训练集之外的每个点直到给定数据结束一个预测:
%x is the data, training set is some subset of x starting from beginning
%'unknown' is the number of points to extend the prediction over starting from the
%end of the training set (i.e. difference in length of training set and data vectors)
%x_pred is set to x initially
p = length(training_set);
coeffs = lpc(training_set, p);
for i=1:unknown
nextValue = -coeffs(2:end) * x_pred(end-unknown-1+i:-1:end-unknown-1+i-p+1)';
x_pred(end-unknown+i) = nextValue;
end
error = norm(x - x_pred)
对此我有三个问题:
1) 这是否符合我的描述?我之所以这样问,是因为在仅预测具有数百个点的数据集的最后 20 个点时,我的错误似乎相当大 (>100)。
2) 我是否正确解释了 lpc 的第二个参数?也就是说,这意味着您要用于预测下一个点的“顺序”或更确切地说是点数?
3) 如果在 Matlab 中有一个更高效的单行函数,我可以调用它来替换循环,并在给定我的整体数据的一些子集作为训练集的情况下为我计算所有必要的预测?
我尝试查看 lpc Matlab 教程,但它似乎没有按照我描述的需求进行预测。我也一直使用How to use aryule() in Matlab to extend a number series? 作为参考。
【问题讨论】:
标签: matlab prediction coefficients