Nonlinear_ls returns incorrect cost value

Hi,

Thanks for being so reactive !

Regarding the first point, I had assumed that the fact that the cost is inf would raise an error status 3 and as the value of the cost is inf from the first iteration which triggers such error, I am trying to understand how come the value of the cost can be inf when to me it shouldn’t be.

Sorry the notation I have chosen are misleading, u_ref is the reference input but as I want to be able to customise the function and have multiple different ones, I have tried to do something similar to this:

wherecost_expr_y = y(x,u) = [f_1]with f_1 = norm(u_ref) y_ref=zeros(1) , W=1

Hope this clears up some of your questions.