user-defined fitting function [Lorentzian] issue

I am trying to fit a portion of my data to a Lorentzian distribution:

F(f) = (A*fc) / (f^2+fc^2)

Where A and fc are fitting parameters. After defining this function and supplying reasonable initial guesses and defining the fitting range, still Igor does not provide a good fit.

The test experiment is attached.
fspecnGraph_1.pxp (71.57 KB)
I am not sure what you expect from the fit. Within the constrains you gave the function Igor seems to have done a reasonable fit. From your test experiment it seems you would like to fit the peak-like structure shown in the graph. Since you haven't given the fit function an offset it is impossible for the fit to match this peak region even coarsely, since this feature resides not at the origin. If your goal was to match the peak-like structure with the Lorenzian you have to include the x-offset: F(f) = (A*fc) / ((f-f0)^2+fc^2)
Also, your data range may be too small to avoid rounding errors. Would it be a problem to scale the x- and y-data to values closer to 1?
Although I didn't give it an offset, I did specify a range for the fit. But, anyway, giving an offset didn't help much. Did you get better results?

And for the data range...I will try that...

EDIT - Scaling the data up so that y values are 1s to 100s, and x values are similar, I find the fit function working very nice. Will check again and report to you.
Thanks. I was trying to see if a user defined function will reproduce what a default function does, so that I can be more assured when I define a new fitting function that have no equivalent in Igor.
Ah, indeed. A good idea.

But the built-in Lor fit function includes an X and a Y offset:
Y = Y0 + A/((X-X0)^2 + B)
where Y0 is a y offset and X0 is the X offset or peak location.

John Weeks
WaveMetrics, Inc.
support@wavemetrics.com