Why does CFTOOL return incorrect fitting coefficients when fitting a SINE curve?

2 views (last 30 days)
Why does CFTOOL return incorrect fitting coefficients when fitting a SINE curve?
I am trying to fit to a simple sine curve using CFTOOL. The "Type Of Fit" selected is "Sum of Sines". The fitting coefficients returned are incorrect.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 27 Jun 2009
Generally, non linear fitting is a difficult process. This problem occurs when fitting certain sinusoidal datasets that have high frequencies with CFTOOL. Fitting performed by CFTOOL will find a local minimum, but it may or may not find the global minimum.
It seems that the fitting functions are much more easily able to fit a curve with a few periods than one with many periods. To work around this try:
1. Using CFTOOL, create an exclusion that includes a few periods and excludes the rest.
2. Fit a single-term sine model to this subset of the data. This should fit easily.
3. Take the solution values from the fit to the subset, and enter them as starting values.
4. Fit the same model to the whole data set.
This problem has also been forwarded to our development staff to be addressed in a future release of MATLAB.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!