Message Boards Message Boards

Iterations error with FindFit

Posted 2 years ago

I am currently trying to run a FindFit command for some data I am analyzing. I can get the function to match my data using a manual manipulation, but I want to cross check the numbers that I am getting by manually altering the function with the computed numbers which FindFit outputs. When I attempt to run the following line

FindFit[normfktkmv, %251*Exp[-b*x], {A, D, W, b}, x]

Where %251 is

(A E^(-(wo^2/(W + 2 D x)^2)))/Sqrt[Abs[W + 2 D x]] /. wo -> 2

I get an error code which states "Failed to converge to the requested accuracy within 100 iterations" with the tag "FindFit". I have not been able to fix this problem on my own. Any suggestions on how to fix this issue? I have included an image of the function plotted manually below. enter image description here

POSTED BY: Oscar Clement
2 Replies
Posted 2 years ago

While it may be handy to use previous results using %n it is much better to use a named symbol set to the result and use the symbol instead. Why?

  1. If you quit the kernel or save / reopen the notebook at a later date, or even reevaluate all cells in the notebook, it is unlikely that %251 is the same.
  2. If you revisit the notebook at a later date you will most likely not remember what %251 was.
POSTED BY: Rohit Namjoshi
Posted 2 years ago

I cannot know if this is the issue because I don't have the data, but

D is the name of the name of the Mathematica Derivative function.

You might try changing that to d or another name that does not conflict with existing names.

And the documentation for FindFit down behind the orange Possible Issues link describes how giving good starting values can sometimes make it possible for FindFit to succeed. If you have good estimates from your Manipulate experiments then try giving FindFit the closest estimates that you have and see if the problem goes away.

POSTED BY: Bill Nelson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract