lsqcurvefit doesn't curve fit
2 views (last 30 days)
Show older comments
Commented: Matthew Hunt on 13 Feb 2019
I have a model which I want to paramtrise using lsqcurvefit. I have 10 parameters that I must find and I have 10 pieces of data (or more) that I can call on. I set up my function that I want to minimise including the function which includes the model. When I use 10 points I get the message that a minimum is possible and when I plot the solution using the parameters and compare it against the experimental data, I get completely different curves, the solution should overly the points I get but that just isn't the case.
Any idea why this would happen?
Star Strider on 13 Feb 2019
Use as many data as you have. Also, nonlinear parameter estimation techniques are very sensitive to the initial estimates (that you give to the routine to start with), and an inaccurate set can cause the routine to end up in a local minimum rather than a minimum that is much closer to the correct parameters. Choosing the correct values can be challenging.
If you repeatedly have problems guessing the correct initial parameter values, use one of the Global Optimization Toolbox functions (such as the genetic algorithm ga function) to search out the best parameter set. Those take time, however they are usually succesful. (For ga, begin with a large initial population, so it has a better probability of discovering the best parameter set.)
Matt J on 13 Feb 2019
Edited: Matt J on 13 Feb 2019
You could have a bug in your model function, such that it is not implementing the curve you that you think it is. What happened when you used your model function code to generate a curve with known parameters? Did the curve look as expected?
Find more on Genetic Algorithm 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!