Can we generate best fitted nonlinear equation between 4 inputs and 1 output, if we dont know the equation initially
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Can we generate best fitted nonlinear equation between 4 inputs and 1 output, if we dont know the equation initially
0 Kommentare
Antworten (3)
Star Strider
am 8 Dez. 2023
Ideally, the nonlinear objective function is a mathematical model of the process that created the data.
Otherwise, there are probably a very large (possibly infinite) number of equations that could fit your data.
So the short answer is ‘Yes’. The problem is that the best fit may not actually tell you anything about the underlying process. Choose the best appropriate model instead of simply the best fit to the data.
0 Kommentare
Image Analyst
am 8 Dez. 2023
There are an infinite number of models that could fit your data. I believe you need to know at least the form of the equation, for example polynomial, exponential, power law, or whatever. Then the fit can give you the values of the coefficients for the model.
Have you tried the Regression Learner app on the Apps tab of the tool ribbon? It will let you try out many different models, and if you don't care about the theoretical form of the equation but only the goodness of fit, you can pick the model with the closest fit. However if you have any idea at all of the theoretical form of the equation, you should pick that and then let the function give you the coefficients. I'm attaching some demos of fitnlm to fit data to models of various forms.
4 Kommentare
Walter Roberson
am 8 Dez. 2023
No, you cannot. There are multiple constructive proofs that if you have a finite number of points known to finite precision, then there is an infinite number of functions that fit the data perfectly to within round off error. The probability that any given function is the "right" one is then 1/infinity, which is zero.
To get a meaningful fit you need to be able to constrain the form of the function. Even that is not always enough.
1 Kommentar
Walter Roberson
am 8 Dez. 2023
Suppose that you had a process that you could pass in a finite set of x and y coordinates, and suppose that the process was able to output a unique polynomial that passed through all of the points.
Now select a finite set of x and y coordinates and pass them through the algorithm, getting out the (by supposition) unique polynomial passing through those points.
Now create two additional sets of input that start with the original points and each add on one additional x and a corresponding y value, and let the additional x be the same between the two extra lists, but let the extra y be different between the two extra lists. Pass each of the extra lists separately through the algorithm that (by supposition) generates unique polynomials that fit the lists.
Now examine the three polynomials. Are they the same polynomials? Well, it could be the case that when you selected the additional points that you might just happened to have selected a point that was exactly on the original polynomial. One of the two extra lists might just happened not to add any additional information to the original polynomial. But since the other of the two extra lists was designed to be different than the other at some specific point, it follows that although two of the three might turn out to be the same, the third cannot be the same.
So now you have either two or three distinct polynomials. And all of the original points are used in construction of the two or three different polynomials, so if you look only at those original points, the two or three polynomials pass exactly through the original x y (by supposition of construction). But you have a minimum of two different polynomials that go exactly through those points. And therefore the supposition that you could have a process to construct unique polynomials must be wrong.
We are backed into a logical corner. At this point we face two possibilities: either given a finite list of finite x y we cannot construct polynomials that pass through the points... or else we can do that but the resulting polynomials are not unique (in which case we cannot use polynomials to fit finite lists and be able to say that we surely got the "right" polynomial out)
Either way, you cannot do what you were hoping to do.
(It turns out that you can construct polynomials through arbitrary finite lists of points with distinct x values, but there are an infinite number of such polynomials.)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!