필터 지우기
필터 지우기

Generate a mathematical funciton from a graph or raw data?

조회 수: 15 (최근 30일)
Ronan
Ronan 2015년 11월 19일
댓글: John D'Errico 2015년 11월 19일
I m used to using mathematical functions however if I want to describe raw data as a mathematical function I m not really sure where to begin. So, for example I know data is linear if y = x and I know its cubic if y = x^3 but is it possible for matlab to use a general function to detect what kind of mathematical function the raw data describes? And based on the description of the funcions described I want to be able to dynamically detect this and change the behaviour of the program based on this.

답변 (1개)

the cyclist
the cyclist 2015년 11월 19일
I appreciate that this seems like a thing that one would want to do. But it is not. Here is a small part of the reason why.
Suppose that you have N = 2 data points. Easy enough! Fit a line. Perfect fit. Done.
Now suppose you have N = 3 data points. Still pretty easy! Fit a parabola (i.e. a 2nd order polynomial). Perfect fit again. I'm so good at this!
N = 4 points ... Fit a cubic, the 3rd-order polynomial. Perfect fit. Wow! (Do you see where I am going with this?)
Arbitrary N points ... Fit an (N-1)th order polynomial. Perfect fit!
The trouble, as I hope you might realize, is that that perfect-fitting polynomial probably has little or no relationship to the underlying process that generated those data, because it is fitting the noise as well as the signal. It is "overfitting".
And, notice, I have only used polynomial fitting here. There are zillions of other functional forms that could also have given perfect fits.
It's a fool's errand to try what you suggest.
For less foolish approaches, I strongly suggest Learning from Data.
  댓글 수: 3
Stephen23
Stephen23 2015년 11월 19일
편집: Stephen23 2015년 11월 19일
What the cyclist states is perfectly correct, but there is also the special case of where you have some prior knowledge of the system, and can therefore limit the system to some known set of functions. This might work if you have measurements of a simple physical phenomenon, for example. In practice this would mean non-linear curve fitting, a fit metric and some selection criteria.
John D'Errico
John D'Errico 2015년 11월 19일
The problem is, in order to use a nonlinear model, you need to have some model in mind. There is no intelligent, automatic way to just pick the overall nonlinear form that would represent your data. Ok, there are computer programs that will fit every model from a complete stable of models, then pick the one with the "best" fit. I have no good feeling towards those schemes. Sorry, but no.
If you have no intelligent choice of model, then it is very often better to use a spline model, such as my SLM toolbox . It allows you to build in your own knowledge about the process into the model, like if it should be a monotonic function.

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

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by