I am using gnuplot to fit some data, however I notice that sometimes my function fails to fit. I believe this is due to an undefined value
which arises due to taking the square root of a negative number. (My understanding is gnuplot fit cannot cope with complex numbers.)
I am using a loop to batch process all my datafiles, and this problem is causing the script to abort.
I don't mind it failing to fit the function - but the script should not abort as this makes the whole point of batch processing everything pointless, as it fails on data file 5 of several hundred.
I have enabled set fit quiet
but this doesn't seem to stop the problem.
How can I force gnuplot to continue
to try and fit the next datafile even if one fit fails?
For reference, the function I am fitting is the following: (This is not the most algebraically simple form - this form is used to avoid division by small numbers.)
f(x) = (bc) / ( [c2.0] + c[b2.0 - c**2.0]*exp(x/e) ) - where b,c,e are fit parameters
So to clarify - sometimes the fit "converges towards a fit where c is negative" which causes the bottom square root to fail to evaluate - and this breaks out of the for loop which contains the fit command - how can I stop the fit failing from breaking out of the loop?