June 13th, 2008, 10:35 pm
Before you try that routine, I would suggest using one of the built-in nonlinear optimizers in MATLAB. Basically just write a .m file that accepts lambda as an argument and returns your objective function. And pass the name of that function and an initial guess for lambda to the optimizer. If that is working for you then you could start testing that coded L-M.