Non linear curve fitting without Toolbox
6 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I want to get started with non-linear curve fitting using the Matlab script since my equation for optimisation has fractional powers. I want to minimize the errors of real and imaginary parts of the equation simulatenously. Any help would be appreciated since I am a beginner.
2 Kommentare
David Wilson
am 2 Mai 2019
You will need the optimisation toolbox (or something similar), and you will need to think about how you combine the real and imaginary residuals, perhaps abs? You could use lsqnonlin or friends.
John D'Errico
am 2 Mai 2019
Bearbeitet: John D'Errico
am 2 Mai 2019
I won't add an answer, since you will need to learn much and I won't want to respond as many times to every follow up question that you will have as a complete beginner, since you willl probably have many questions to resolve. Having a toolbox, like the curve fitting toolbox, or the optimization toolbox will help, even the stats toolbox, because they do some of the work for you. As well, those tools will be more capable than something like fminsearch, and you can get out some statistics on the result, that a lot of people want to see. But even with one of them, you still need to learn concepts like:
- How does an optimizer work? If you don't understand the tool you use, you are lost. You need to understand about the iterative method involved. You need to understand about the need for starting values, and why good ones can be valuable. You need to learn about divergence, about convergence. About multiple local sub-optimal solutions (again, good starting values are useful!).
- Writing an objective function, about how to pass in the neccesary information to that objective.
- How to deal with a problem with real and imaginary parts. Can the parameters also be complex too?
- What is a convergence tolerance? What does it mean?
- Are there constraints on the parameters? Note that fminsearch does not allow for constraints, even bound constraints, although you can use my own fminsearchbnd, which adds lower and upper bounds on the parameters.
- Is your data even sufficient to solve this problem? Many times people provide utter crap for data, and somehow expect magic to result. The phrase about making a silk purse from a sows's ear springs to mind.
Probably a few other things that I completely forgot to list. Do you need a toolbbox? Well, you can use fminsearch as an optimizer. But it is limited in scope, not working well beyond about a half-dozen parameters, which is a typical limit that I try to apply. It simply gets lost in too high dimensional problems. In a pinch, maybe 8 parameters. It does depend on how good are your starting values, and how nasty is the problem. Once you start to introduce complex numbers and fractional exponents, things can get nasty.
And you would need to learn much of that when using an optimization tool that is more designed for curve fitting. But then something like the curve fitting toolbox has much more extensive documentation than a simple tool like fminsearch, and that documentation is directed explicitly at the problem of curve fitting.
I would do a little reading. First, read the docs for fminsearch completely. And don't even try to start solving the problem you want to solve. Learn to solve SIMPLE problems first, using fminsearch, since that is the only tool you will apparently allow yourself. This is all doable.
Antworten (0)
Siehe auch
Kategorien
Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!