On Wednesday, April 27, 2016 at 1:29:37 PM UTC-7, Hans-Bernhard Bröker wrote:
> Am 27.04.2016 um 19:38 schrieb Andrew Finlay:
>
> > I'm trying to write code to automatically fit binned simulation data
>
> Bad idea. 'fit' is not a tool to be used blindly, or automatically.
>
> Non-linear least-squares fitting needs guidance and consideration of the
> condition of the input, or you'll run into numerical instabilities much
> of the time.
I understand where you're coming from here, but I thought my initial parameters were close enough that the algorithm should have been able to converge, though maybe I was wrong. And they weren't chosen blindly, the starting parameters are based on the mode and the standard deviation of the unbinned data points. I played around with those parameters some, I got rid of the "Singular matrix in Invert_RtR" error, but now it just doesn't modify my parameters at all. I don't know if I've simply hit the limits of what fit can do. Here's a link to an image of what I came up with anyway:
https://drive.google.com/open?id=0B2-M7wNoiJi2bUF3MTkwMmN4bFE
> So let's see why this particular fit failed. Well, for starters the
> data is quite clearly not Gaussian at all. It's highly asymmetrical,
> and the tails are way to wide for compared to the FWHM.
>
> Trying to fit a Gaussian to that data is an exercise in futility.
I would argue that the peak is Gaussian to first order approximation. It's not truly Gaussian obviously, but you should still be able to produce an approximate fit. Though perhaps not in gnuplot...
Thanks anyway.