Equivalent to lsqcurvefit() without the need of the optimisation toolbox

21 visualizzazioni (ultimi 30 giorni)
Hi
Please let me know additional equivalent functions to lsqcurvefit() with no need to have the optimization toolbox and yield the same outcomes and get the same inputs.
Thanks

Risposta accettata

John D'Errico
John D'Errico il 21 Ott 2019
Modificato: John D'Errico il 21 Ott 2019
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.

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by