0

I have a time series of N data points of sunspots and would like to predict based on a subset of these points the remaining points in the series and then compare the correctness.

I'm just getting introduced to linear prediction using Matlab and so have decided that I would go the route of using the following code segment within a loop so that every point outside of the training set until the end of the given data has a prediction:

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

I have three questions regarding this:

1) Does this appropriately do what I have described? I ask because my error seems rather large (>100) when predicting over only the last 20 points of a dataset that has hundreds of points.

2) Am I interpreting the second argument of lpc correctly? Namely, that it means the 'order' or rather number of points that you want to use in predicting the next point?

3) If this is there a more efficient, single line function in Matlab that I can call to replace the looping and just compute all necessary predictions for me given some subset of my overall data as a training set?

I tried looking through the lpc Matlab tutorial but it didn't seem to do the prediction as I have described my needs require. I have also been using How to use aryule() in Matlab to extend a number series? as a reference.

4

1 回答 1

0

因此,经过深思熟虑和实验,我发现上述方法是正确的,并且似乎没有任何单一的 Matlab 函数可以完成上述工作。经历的大错误是合理的,因为我使用线性预测算法来解决具有固有非线性行为的问题(即太阳黑子预测)。

希望这可以帮助其他从事类似工作的人。

于 2014-10-28T23:56:57.160 回答