Jan, Your submission was very helpful for me. I am quite new to matlab and had trouble figuring out how to use lsqcurvefit for 2-d fitting. Going through your program helped me figure out the mistakes I was making.
I have just submitted a new version. There I have changed the aim of the whole package towards demonstrating the possibilities of the functions lsqcurvefit/fmincon/fminsearch. The syntax is now much more clear and is similar to the syntax of the underlying matlab functions. Much more comments, explanation, h1 lines and error checks have been included. (Indeed much more than usual for me. :)) However also some additions have been taking place that might be of interest. In particular fit_nl_ex() now maximizes the likelihood and is therefore more universal than only least squares. Treatment of Poissonian noise which often occurs e.g. in imaging is incorporated. And I have included the possibility to add penalties depending on the parameter on the likelihood. Matlab itself has only all-or-nothing penalties via the extended options of fmincon. But when you know something about the distribution of parameters instead of hard borders an additive penalty is the choice.
However, instead of the assuring results of the test routine fit_test there might still be errors, both conceptual and coming from programming. Please let me know about them. I will correct them. However, I do not plan to add any functionality further than this.
The second version only has one or two more comments. The definitions of the built-in functions are explained. I am still working on an improved version.
I hope that you fix the problems. I'm always happy to update my review to reflect problems that have been repaired, and I'm always willing to work in depth (via e-mail) with an author who wants to improve something. I see that there is a new version, so I'll take a second look today.