Is it possible to develop an equation from the data using MATLAB?

22 visualizaciones (últimos 30 días)
Thompson Bliss
Thompson Bliss el 15 de Feb. de 2017
Comentada: John D'Errico el 15 de Feb. de 2017
Hello. So I am attempting to find an equation to accurately fit about 8,000 4 dimensional data points. I have both the Curve Fitting Tool Box as well as the the Statistics and Machine Learning Tool Box. I have already attempted to find an equation through brute force testing and using non-linear regression functions to find the coefficients. Is there anyway using one of the tool boxes or MATLAB code to input data points and get an equation to fit to as an output?

Respuestas (2)

the cyclist
the cyclist el 15 de Feb. de 2017
There are many tools for fitting data with MATLAB. This page is a good starting point.
  4 comentarios
Thompson Bliss
Thompson Bliss el 15 de Feb. de 2017
Editada: Thompson Bliss el 15 de Feb. de 2017
I apologize. I will give some more details. So my project is to try and find an equation that will calculate a value called the Lyapunov Exponent based on three parameters: rho, beta and sigma. Here is some sample data:
Essentially, I am unsure of what equation should be used to try and fit to it. Here is the meat of my code so far:
xdata =[beta,rho,sigma];
fun = @(C,xdata) C(1).*(xdata(:,1)).^2 + C(2).*(xdata(:,1)) + ...
C(3).*(xdata(:,2)).^2 + C(4).*(xdata(:,2)) + ...
C(5).*(xdata(:,3)).^2 + C(6).*(xdata(:,3)) ...
+ C(7).*(xdata(:,1)).*(xdata(:,2)) + C(8).*(xdata(:,1)).*(xdata(:,3))...
+ C(9).*(xdata(:,2)).*(xdata(:,3)) + C(10);
%Defining initial guess
initialGuess = zeros(1,10);
%Using lsqcurvefit command to complete Least Square fit
coef = lsqcurvefit(fun,initialGuess,xdata,LE);
Here, I tested a polynomial with cross terms as the equation to fit to. Unfortunately, when I tested the coefficients I have way too big of an error (around 1%). I have tested countless different equations to fit to and used pretty much every fitting algorithm out there (polyfitn, fitnlm ect.). I currently believe my problem is that I am not trying to fit to the correct equation. I am curious to know if there is a way to input my data and receive an equation as an output. Thanks.
John D'Errico
John D'Errico el 15 de Feb. de 2017
Note that a picture of your data is useless for anyone to help you, since they cannot paste it into MATLAB in numeric form. If you want help, then make it easy for someone to help you.

Iniciar sesión para comentar.


John D'Errico
John D'Errico el 15 de Feb. de 2017
Editada: John D'Errico el 15 de Feb. de 2017
There are an infinite number of ways to predict any set of values like that you give. So this means you cannot get THE equation that predicts your relation, because any of the infinite number of possibilities would suffice.
There are may common solutions one might use, but NO from what you have said, I would never recommend polyfitn for this problem, even as the author of that tool. And trying to fit a polynomial model to the data using optimization tools is patently silly, since polyfitn fits the same model using a better algorithm for that problem, but requires none of the overhead or hassle of an optimizer. Regardless, a polynomial model is simply the wrong way to solve this problem.
I would normally suggest either a simple interpolant, such as scatteredInterpolant, or a tool that uses a distance based interpolation. So kriging is a common one, but also radial basis functions, splines, etc. In some cases, tools like 3-d lookup tables, which are designed to be interpolated, can be right. But you would need to know how to build those 3-d lookup tables, something that can take far more effort than you want to deal with.
Any of the above tools will not give you some nice function that you can write down and admire though. Just something that can be evaluated to predict the result.
Sadly, you give only a picture of your data, and since I will not spend the effort to type in your sample data from the picture, this is where I give up.
  1 comentario
Thompson Bliss
Thompson Bliss el 15 de Feb. de 2017
John D'Errico, thanks so much for your advice. I feared that that would be the case. If you wish to take anything a step further, I attached an excel document containing the data so you do not have to type it in from a picture.

Iniciar sesión para comentar.

Categorías

Más información sobre Get Started with Curve Fitting Toolbox en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by