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.
Best Answer