Hi Paul,
You should be careful when using the square root function as it is not
differentiable at 0 (cf the attached file which illustrates this point
in your case). This will leads to issues and prevent optim from "really"
(in a sound way) converging towards the solution.
To address the issue,
Hi Paul,
your cost function
*f*= sqrt((val_lin - val_rac)^2);
hasn't changed, since sqrt(x^2)=abs(x). What I meant before is replacing
*f*= abs(val_lin - val_rac);
by
*f*= (val_lin - val_rac)^2;
in order to make it differentiable. When using a non-differentiable cost
function together