Extrapolation of 1600 points dataset
조회 수: 2 (최근 30일)
이전 댓글 표시
Hi, I tried to use interp1 function to extrapolate a dataset consists of 1600 points (read from Excel sheet). The variable extracted the data and can plot it easily. However, the resulted plot of interpolated and extrapolated data is linear!!!!
Here is the code I used for testing:
data=xlsread('DATA.xls','A2:A1601'); x=[1:1:1600];
xi=1:1:1700;
z=interp1(x,data,xi,'spline','extrap');
plot(x,data,'or',xi,z);
댓글 수: 0
채택된 답변
the cyclist
2011년 6월 25일
Neither the interpolation nor the extrapolation are linear, although I can see why you might think they are, given what you've plotted.
In the interpolated region, because you've chosen the interval of xi to be the same as x, all you are getting is the (perfect) match with your known points, and the lines are just connecting the dots, so you see line segments. If you were to choose the interval to be, say, 0.1 instead, then you would see the nonlinearity of the spline.
In the extrapolated region, you can see the nonlinearity if you zoom into the area just after the known points. It rockets north very rapidly, and looks linear after that.
Here is some code, slightly edited from yours, that illustrates these thoughts:
data=xlsread('DATA.xls','A2:A1601');
x=[1:1:1600];
xi=1:0.2:1603;
z=interp1(x,data,xi,'spline','extrap');
figure
plot(x,data,'or',xi,z);
set(gca,'XLim',[1595 1605])
I'm not sure what you were expecting, but simple extrapolation is not going to replicate the pattern in the known region. If that was what you wanted, you're going to need some kind of simulation, maybe based on the mean growth and variance of the known data.
댓글 수: 2
the cyclist
2011년 6월 26일
ARMA is certainly commonly used. I don't know much about NN for this sort of thing.
Also, it would be good for you to "accept" my answer since you found it helpful, so that others seeking similar solutions will find it more easily.
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Interpolation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!