From: Tazmusica on
"Roger Stafford" <ellieandrogerxyzzy(a)mindspring.com.invalid> wrote in message <gi9j84$miq$1(a)fred.mathworks.com>...
> "Tazmusica " <tazmusica2(a)deletethis.gmail.com> wrote in message <gi91ji$b7a$1(a)fred.mathworks.com>...
> > Roger,
> > Thank you for the suggestion. I can see that the Lorentzian is linear in the a and vshift terms, and I see that this reduces the number of parameters that fminsearch has to deal with. So if the function of Lorentzians were called L(x), and each lorentzian in the sum were l(x), then L(x)=a1*l1(x)+a2*l2(x)+a3*l3(x)+vshift. What I am unclear on is how to rewrite the function to always achieve the minimum of the a and vshift values. I can see where it should be the solution to a system of linear equations that would automatically minimize the a and vshift values, but I guess I am not seeing how I can get this into a form that I can pass to fminsearch using only the remaining 6 parameters. I apologize for being so obtuse, and I thank you for all of your help.
>
> Fortunately John has come to the rescue with his 'fminspleas'. I was either unaware of, or had long since forgotten, its presence in the File Exchange, but happily that saves me a lot of work explaining how to carry out this procedure. Hopefully my earlier remarks should at least give you an idea of the theory behind 'fminpleas' action.
>
> As you can probably surmise, if the number of Lorentzians were to get up to or past five with two parameters each, you may still encounter the sort of difficulties you have experienced, even using 'fminpleas'. Sending a large number (like ten) of nonlinear parameters to fminsearch may still make life difficult for it in converging to a successful solution.
>
> A lot could depend on the accuracy of your initial estimate in getting the iteration process off to a good start and with ten parameters that could be tricky. I would suggest playing around with the plot function in arriving at rough curve fits to assist in arriving at such estimates.
>
> Roger Stafford

Roger and John,
Thank you very much for your help. I am going to work my way through fminspleas to see if I can figure out how it works. I appreciate your input. Most of my data sets should be fine using that. I am a little bit concerned about fminspleas having problems with my data sets that need to fit to 5 or more lorentzians, as you predicted. Is there a better was for me to do fits in those cases? Thanks again for everything.