How does matlab cftool (curve fitting toolbox) determine StartPoint for Sum of Sin fit?

2 views (last 30 days)
For example given a data set:
y = {3,4,7,8,5,2,0,-1,-4,-2,0} t = {1,2,3,4,5,6,7,8,9,10,11}
I want to model the data with:
a1*sin(b1*x+c1) + a2*sin(b2*x+c2).
I have found information on the Levenberg-Marquardt and Gauss-Newton methods to perform this optimization, but none speak of how to obtain the initial guess.
When I use the cftool to do the above in Fit options it seems to have a pretty good initial guess, can anyone shed light on how it obtains its startpoint?
I realize this might be proprietary information, but I would really like to be able to perform this kind of optimization by hand, for intellectual reasons, if anyone could help me or point me to a place that might, that would be grand.
Regards,
Michael Motes

Accepted Answer

Tom Lane
Tom Lane on 15 Aug 2012
It's not that proprietary. It's implemented in MATLAB code that's shipped with the product, in particular in the @fittype/private/sethandles function. It uses fft to find the frequencies, as you will see by looking in this file.
If you do try a variant on this yourself, I'd be interested in hearing about it by e-mail.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!