
Trouble with Curve Fitting a Custom Fit Function

Krunkyjunk
I am new to Igor and trying to fit a custom fit function. However I continue to get a ""The fitting function returned NaN for at least one X value." error, which I thought was due to my initial guesses being too far off to fit the function, but I no longer think that that is the issue because the fit function seems to lay directly on top of the plot.
I have attached my Igor experiment as I am not sure how else to show my problem. Please let me know what more I need to show to better explain my predicament.
This makes it easy to see that if theta=0, then both numerator and denominator are zero. Dividing zero by zero is not well defined:) I see that one of your Angle points is zero.
I also put a breakpoint on the "Uh oh" line and ran the function from the command line:
print singleslit(w_coef, 0)
. It broke into the debugger as expected. If your function had been more complex and not amenable to separation as I re-wrote it, the debugger would have given me a chance to investigate just what was going on. I often use this technique of testing the return value in order to make a good place to put a breakpoint that doesn't break every time it runs, just when it goes wrong.If you're not familiar with Igor's symbolic debugger, read this:
DisplayHelpTopic "The Debugger"
John Weeks
WaveMetrics, Inc.
support@wavemetrics.com
April 1, 2016 at 02:59 pm - Permalink