Equivalent to lsqcurvefit() without the need of the optimisation toolbox
13 ビュー (過去 30 日間)
John D'Errico 2019 年 10 月 21 日
編集済み: John D'Errico 2019 年 10 月 21 日
If you are hoping to find someone who provides code in MATLAB here to yield the identically exact same results as lsqcurvefit, it won't happen, as that would be a quite complex thing to write for free.
If you are willing to accept methods that are highly limited, then yes, you can find simple nonlinear regression codes on the file exchange, perhaps using fminsearch. But remember that fminsearch is a VERY limited nonlinear optimization tool. And in the end, it will not give you the same results as lsqcurvefit. It will run more slowly. It will not converge as rapidly. It will be highly limited in the number of parameters you can solve for. It will not yield the same outputs that lsqcurvefit does, so if you want something like the Jacobian, too bad.
You may also find tools on the FEX that do a variety of nonlinear regressions using perhaps Gauss-Newton, or even Levenberg-Marquardt. Just remember that free code, written by a novice may not be worth much. So take the time to check out the code, read the reviews carefully, sometimes with a grain of salt, as I have seen people getting their grandmother to write reviews for student written tools on the FEX.
If you have the stats toolbox, then it has a very capable nonlinear regression tool in it. (nlinfit) But it will not be a drop in replacement for lsqcurvefit. (Not too far off though.) If you have the curve fitting toolbox, then it too has capable tools in it, that may be acceptable to you. Of course, they will be even less of a drop in replacement for lsqcurvefit than is nlinfit. Still quite capable, but it will require you to learn to use the tools, and understand how to use them to fit your model.
The optimization toolbox is not that expensive, compared to the amount if time it would take you to replace the call you wish to replace. Your own time is worth something.