I am having some issues with finding good initial conditions for a fit that just won't behave. So I had the idea to Brute-force it by inserting it in a loop that tells gnuplot to keep fitting until he gets a relative deviation of less than 100% while randomly changing initial values each time he re runs the loop, i wrote something like that:
while(abs(m_err/m) > 1){
m = rand(0)*0.3
k = rand(0)
x_0 = 15 + rand(0)*10
fit logi(x) 'data.csv' u 1:8 via m,k,x_0
}
i multiply the rand function so that i get values near the value i expect to be good for fitting.
This method obviously results in a lot of fits not converging and stopping the script mid-loop. How can i tell gnuplot to simply ignore this and just re-run the randomization and fitting loop if the fit doesn't converge or it gives a singular matrix?