I fit with P2 by keeping P1 constant to a value val0 in the graphical interface. However the fit does not converge properly.
If I remove the line P1=P1*1.0e-9; in the program and fit by keeping P1 constant to val0*1e-9, the fit works perfectly.
Is it forbidden to change the value of one parameter in the body of the fit function? I thought it would be ok, since parameters are passed by value and not by reference.