Does MATLAB have any toolboxes or commands for predicting the next number in a series?

조회 수: 10 (최근 30일)
I have a data series x as a function of time y:
x=[14,14,3,4,8,3,2,5,11,2,1,5,10,2,4,1,8,11,5,1,3,1,2;]
y=1:1:23
How do I predict the next number (x,y=24)? Does MATLAB have any toolboxes for that type of problem or will I need to code something like a neural network solution from scratch?
Cheers
  댓글 수: 1
Greg Heath
Greg Heath 2017년 4월 2일
Why in the world are you using x(y) instead of the worldwide timetested standard y(x)?
Dizzily,
Greg

댓글을 달려면 로그인하십시오.

답변 (3개)

Jan
Jan 2017년 3월 27일
편집: Jan 2017년 3월 27일
19.
Carl E. Linderholm showed, that any sequence of numbers can be continued by 19. It is easy to construct a corresponding Lagrange polynomial p(x) such that p(1), p(2), ... p(n) yields the given numbers and p(n+1) is 19. This rule is much easier than all other rules and is applies in general.
Of course you could use your favorite number also. But then this gives psychologists the chance to interpret your subconsciousness. So better choose 19 (and do not tell anybody if this is your favorite number).
See http://www.whydomath.org/Reading_Room_Material/ian_stewart/9505.html (they claim it was a Laplace interpolation - fortunately the law is such universal, that this detail does not matter.)
  댓글 수: 1
Image Analyst
Image Analyst 2017년 4월 1일
I totally agree with Jan. In fact there was a controversy some years ago about using such "predict the next number" questions on college entrance exams because virtually any number (any one of their choices) could be an answer using some formula. You can't really say any of the numbers is right and all the rest are wrong.

댓글을 달려면 로그인하십시오.


John D'Errico
John D'Errico 2017년 3월 18일
편집: John D'Errico 2017년 3월 18일
There is no reason to suppose that the next INTEGER in that series will be easily predicted. Neural nets are not a magical tool that will do here. For example, consider this vector?
[3 5 4 5 6 8 9 8 12 11 10 12 9 11 11 11 10 9 11 11 13 12 12 11]
What is the next term in that series?
Will any neural net be able to predict intelligently that the next term is 12? You might guess what the number is. But KNOWING with any confidence what the next number is will never be something a statistical tool can do, merely by looking at the numbers.
Worse, any numerical tool that would try to extrapolate a series would not understand that the result would be an integer. Any simple extrapolant would probably predict some floating point number.
Ok, I'll even be nice and tell you the next 5 numbers in that sequence. They are [12 15 17 17 16]. What is the next number? Feel free to postulate what is the mechanism behind that sequence. A little creative thinking should suffice. Statistics won't help though.
Unless you actually see the pattern, you will not be able to predict this sequence easily. In fact, I was wondering if oeis would be able to solve it.
https://oeis.org
oeis is a great source to solve such problem sequences. But I'm not at all surprised that it did not find a match for either the sequence you gave, or the one I posed.
  댓글 수: 4
John D'Errico
John D'Errico 2017년 3월 28일
Actually, in the series I posed, the next term would have been 20. And the one after that? 24.
Alex
Alex 2017년 3월 29일
편집: Alex 2017년 4월 1일
Great idea, I will look into the auto-correlation function more: https://www.mathworks.com/help/signal/ref/finddelay.html
16, then 1 are the next number for my series. I wasn't taking a guess at the new one you posed. I am not sure whether to treat the vector X as my signal or to pad it up to the value of the largest integer to treat each integer as a separate sensor to compute the time delay between when the same number is repeated.

댓글을 달려면 로그인하십시오.


the cyclist
the cyclist 2017년 3월 18일
편집: the cyclist 2017년 3월 18일

The Statistics and Machine Learning Toolbox has many, many tools for making inferences from data.

You could also try the Neural Network Toolbox, but I don't think you need that.

But if you just plot your data

x=[14,14,3,4,8,3,2,5,11,2,1,5,10,2,4,1,8,11,5,1,3,1,2;]
y=1:1:23
figure; plot(y,x,'o')

you'll see that y is certainly not very predictive of x. (But maybe even a little predictive power is OK for your application.)

  댓글 수: 3
the cyclist
the cyclist 2017년 3월 18일
편집: the cyclist 2017년 3월 18일
Ah, fair enough!
Do you have some underlying theoretical model? nlinfit from the Stats toolbox is one possible tool.
Also, I don't have much experience in this area, but this might be more of a signal processing problem. There is a separate toolbox for that, too. Or maybe you could use the fft function in base MATLAB.
Alex
Alex 2017년 3월 25일
Thank you, I am interpreting the data as voltages from a sensor so tried using FFT (I tried using all three examples in the FFT documentation: 'noisy signal', 'gaussian pulse' and 'cosine') to see if I could compute the amplitude and frequency spectrum(s), but do not see to have a central frequency. I believe I need more data.
I do not have a model to use nlinfit, but have noted this as something to try in the future. Thank you for your helpful suggestions!
Cheers,
Alex

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Mathematics에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by