Fix lsqnonlin in Octave
Should also be backported to 4.6
This commit was removed from !1780 (merged) and put as a separate merge request.
Should also be backported to 4.6
This commit was removed from !1780 (merged) and put as a separate merge request.