Azzera filtri
Azzera filtri

How to fit a function that has significant changes dependent on small changes of some parameters

7 visualizzazioni (ultimi 30 giorni)


I am fitting a function to data using curve fitting tool in Matlab. The function is very sensitive to two of the fitting parameters (I have totally 6 fitting parameters) and even a very small change in these two parameters make a huge change in the function. Considering this fact, the upper and lower bound of the parameters is quite large. For example, assume parameter L can vary from 0.0035 to 0.0045 while a change in the order of 0.00400006 can make a huge change in the function and make it something different. I have attached an example of how the function changes, when I change L from 0.00400000 to 0.00400006. As a result when I try to have this fitting parameter in my fit and set the lower and upper bound the same as I mentioned, and let's say an start point of 0.004, Matlab only goes true those small increments changes of this parameter and never try the change in order of something like 0.0042 in the parameter. And I have two parameters like this in my fit. Any comments on how can I overcome this challenge?

Thanks in advance!

  2 Commenti
John D'Errico
John D'Errico il 27 Nov 2022
Modificato: John D'Errico il 27 Nov 2022
Please stop asking essentially the same question. I just spent 20 minutes writing an answer to your last question. You will need better data, or possibly a better model for your data.
Shaily_T il 28 Nov 2022
Thanks for your time! But as I mentioned in this question I can find a set of parameters that give a reasonable fit if I have only one or two fitting parameters. This issue arises when I want to have all the parameters as fitting parameters.

Accedi per commentare.

Risposte (1)

Matt J
Matt J il 28 Nov 2022
Modificato: Matt J il 28 Nov 2022
Change the units of L to something smaller. Stop trying to measure the distance between houses in kilometers rather than in meters. It would probably also help to change the units of your xdata so that they are ~1e1 rather than ~1e14.
  3 Commenti
Matt J
Matt J il 29 Nov 2022
Modificato: Matt J il 29 Nov 2022
You could do that, or, if your model function is F(L,x), wrap it with something like,
Fnew=@(deltaL,x) F( 0.004 + deltaL*(1E-8) , x*(1E13) )
You would of course need to adjust the initial guess of the parameters as well, to be consistent with the change of variables.

Accedi per commentare.


Scopri di più su Get Started with Curve Fitting Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by