Can I make curve fitting equation for more than 5 variables? My data points of 5 variable is more that hundered.

29 views (last 30 days)
I am working on an project which has given me output of five variables.Each variable has 100 points.I want to make equation of 5 variables which is equal to output.i.e y=f(x1,x2,x3,x4,x5......,xn). I have array of x1,x2,x3,x4....xn.Can I find the function f using MATLAB?
  1 Comment
John D'Errico
John D'Errico on 30 Apr 2018
Can you find "THE" function f, without having a clue as to the model behind this data? Absolutely not. I'm sorry, but there are infinitely many possible surfaces and surface shapes. There is no magic scheme where form of the underlying equation will simply appear.
Do you have a model? Thus, you know the underlying relationship that you expect to see, but you just don't know the parameters? Well, then the answer is absolutely yes, within limits. You can use tools like lsqcurvefit or lsqnonlin from the optimization toolbox. Or nlinfit from the stats toolbox. These three tools apply to nonlinear models, where the parameters enter nonlinearly.
But the above tools REQUIRE, ABSOLUTELY REQUIRE that you know the underlying model. What can you do when you do not know the model? Some people decide to fit a polynomial model to their data. Sadly, in a high number of dimensions, 100 data points is not a lot. There are simply dozens of terms in even a 3rd order polynomial model in 5 dimensions.
If the model is a SIMPLE one that is polynomial in nature. For example, you hope to fit a linear surface through the data, then you could use my polyfitn (available by download from the File Exchange.) Or you could use regress from the stats toolbox.

Sign in to comment.

Answers (1)

Walter Roberson
Walter Roberson on 30 Apr 2018
If you have a model for the equations then you can use the curve fitting toolbox with anonymous functions.
If you do not already have a model for the equations, then NO, you cannot do that. For any given finite list of finitely-represented values, there are an infinite number of functions that generate the list of values perfectly (to within round-off error.) Because there are an infinite number, there is no way to determine which one is the "right" one.

Community Treasure Hunt

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

Start Hunting!