Curve fitting: Difference fit, nlinfit, fitlnm

15 次查看(过去 30 天)
Hi,
does anyone know about the differences between commands 'fit', 'nlinfit' and 'fitlnm' for conducting nonlinear regression analysis? Can't really find anything in the documentation.
Thank you
Vince

采纳的回答

John D'Errico
John D'Errico 2016-12-1
编辑:John D'Errico 2016-12-1
The differences are simple. These tools mainly come from different toolboxes. That is really the main difference. Curve fitting is such a common problem that it is solved by many tools. You can solve any given problem with any tool. In fact, there are other tools, such as lsqnonlin or lsqcurvefit (optimization TB).
But suppose you own one of those toolboxes doing stats, optimization, or curvefitting. You would expect ANY of those toolboxes to offer this capability, and they do! Of course, they do other things too.
There are differences in the interfaces, mainly because they were all written by different people. So you might prefer one tool over another. Other reasons to prefer one over another is some allow bounds on the variables, some allow weights for the data points, some allow robust fitting, etc.
The point is, if you have two different tools that compute a minimum sum of squares of residuals for a given model, as long as both of them have converged, you really don't care which one you used.
  4 个评论
able_archer
able_archer 2016-12-1
Ok, fine.
I'll just stick to 'fit' as it seems easiest to handle. It's true you can set a lot of options, but 'nlinfit' offers even more. It's interesting Mathworks offers multiple tools for the same purpose and does not point out the differences :)
John D'Errico
John D'Errico 2016-12-2
Different toolboxes are written by different authors, so subtly different slants to how they work and what options they offer. They usually have disjoint purposes with little overlap. But curve fitting & nonlinear modeling is just such a common problem that it is appropriately dealt with by several sets of tools.
For example, suppose someone just buys the optimization toolbox? They would surely expect it to contain a tool to solve nonlinear least squares, since that is one of the most common optimization problems one sees. Ergo, we havelsqlin, lsqnonlin, & lsqcurvefit. They have an interface that is consistent with the other optimization tools.
Suppose someone only bought the stats toolbox? Surely one would expect a modeling and estimation tool in there, capable of doing regression in several forms. So we find tools in that TB too.
And of course, there is the person who really only ever needs to do curve fitting, in many forms. They bought the curve fitting toolbox.
Yes, one could write up a complete comparison between these tools, subjectively comparing their abilities. One may have slightly better robust capabilities, another allows you to enter weights (Note that it is easy to solve a weighted problem even if the tool does not explicitly have that capability.) But the point is that the importance of such differences is quite subjective.
In fact, I have all three of those toolboxes. But when I want to do a nonlinear regression, which one do I usually use? :) The funny thing is I use the 4th alternative. Years ago, I wrote a nonlinear modeling toolbox that has many of these same capabilities, before the curve fitting toolbox ever existed. My toolbox is something that I know extremely well. It has very good estimation capabilities, because it is based on a method called partitioned nonlinear least squares. So it is more robust to problems that would cause other methods to fail, and at least, it will be more efficient. I put a nice point and click graphical interface on the tool, all of which still works nicely, despite being well over 15 years old. So when I solve a problem, I go first to the tool I am most familiar with. And since I think the author is such a great guy (patting myself on the back) why would I use anything else? :)
So if you have several of them as an option, use what works best for you, what feels right. Any of these tools will solve most problems with few issues. If you need a reason to decide which TB to buy, make that decision based on which types of problem you tend to solve.
If one is a statistician who needs to solve a wide variety of stats problems, then buy the stats TB. If you need to solve many general optimization problems, then buy the optim TB. If you are only going to do curve fitting, then buy that TB.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Get Started with Curve Fitting Toolbox 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by