faeriewhisper
faeriewhisper

Reputation: 37

data fitting in specific equation - matlab

I have 3 sets of data: xdata, ydata and error_ydata.

I need to fit this data according to a equation like this:

y_fit = c1*sin((2*pi*x_data)/c2 - c3) + c4

where c are constants, and the parameters to find.

I've tried several matlab functions like fittype or lsqcurvefit but they require very close initial estimates for the 4 constants to work. The point was to find these constants whichever are the initial estimates you give.

Any idea?

Thank you in advance. My best regards

Upvotes: 1

Views: 890

Answers (1)

user85109
user85109

Reputation:

Sorry, but the fact is, nonlinear estimation requires at least decent starting values. If you can't bother to supply them, then expect at least some of the time random crapola for results.

Do those tools require VERY close estimates? Hardly so IMHO, but the definition of "very" is a highly subjective one. Perhaps you need to learn more about optimization and the tools that you will use. Once you do, you will start to know how to make them work better. A workman who lacks understanding of their tools should expect to get hurt on a frequent basis.

You might do some reading. Here is one place to start.

There ARE some tools out there that allow a reduction of the problem using a partitioned least squares approach. fminspleas is one. (You can also find pleas in the optimization toips and tricks file.). But in order to use that tool, you will need to learn something about its estimation methodology, understanding how it splits the parameters into two classes. Again, understand your tools.

Upvotes: 0

Related Questions