Multidimensional fitting using "nlinfit"
2 views (last 30 days)
Show older comments
Is there any way to do multidimensional fitting using "nlinfit"? Or it is just for 1D fitting? I mean something like the following, assuming z = f(x,y)
[coeff] = nlinfit([x, y], z, @myFun, initialCoeffs);
If yes, how should I define the initial fitting coefficients? All of the instructions that I found work well only for functions like y = f(x).
I know that we can do a similar thing using fitting toolbox but I am intending to use nlinfit because it looks much faster for 1D fitting. I cannot use "lsqcurvefit" as it does not give the fitting error.
Thanks!
0 Comments
Accepted Answer
Matt J
on 14 Feb 2014
Edited: Matt J
on 14 Feb 2014
I don't have the Stats Toolbox, but according to the online documentation, you can do exactly what you've shown, assuming x,y,z are all column vectors.
As for the initial parameter values, that's always a matter of ingenuity, and insight into the particular model function that you have. Often, you would look for some semi-accurate approximation to the model function, that is easier to fit, and use that simplified fit as your initial guess.
I cannot use "lsqcurvefit" as it does not give the fitting error.
That shouldn't be a major barrier, in any case. LSQCURVEFIT does return the residual and Jacobian from which your other goodness of fit measures can be easily calculated.
0 Comments
More Answers (0)
See Also
Categories
Find more on Get Started with Curve Fitting Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!