MATLAB: Decrease step size in lsqnonlin() for presentation.

diffmaxchangelsqnonlinoptimization

I am using the lsqnonlin optimization function to minimize an objective function with ~50 variables. I'm also making a movie (using OutputFcn with getFrame) to show what is happening the these variables at each iteration (for presentation purposes).
Currently, the algorithm does ~20 iterations before it stops so my video ends up with 20 frames. 20 frames isn't enough if I want a nice smooth movie that is at least 5 seconds long. I figure I need roughly 120 frames (5 sec. * 24 FPS) to get a nice smooth video. The only way I can think to do this is to force the optimization algorithm to do at least 120 iterations.
What options could I play with to force more iterations from lsqnonlin? DiffMaxChange maybe? Note that I don't want to just have it continue doing iterations after a solution is found. Rather, I want the objective function to change less between iterations.
Any help or insight would be greatly appreciated. I don't know much about how these optimization algorithms work.
Regards, Justin

Best Answer

So you want a less efficient solver, one that takes more function evaluations to find an optimum? I think you are making a mistake in your thinking. You should be happy that lsqnonlin takes so few steps.
You have many options for making a movie. You could show 6 frames of each current frame. Or you could interpolate results, if that makes sense for what you are trying to do, perhaps coloring things different for the interpolated frames.
If you really want to mess up lsqnonlin, and have it converge slowly, or not at all, give an erroneous Jacobian and set the 'Jacobian' option to 'on'. But I think this will not show how the solver works when it is working well.
Alan Weiss
MATLAB mathematical toolbox documentation
Related Question