I am lost. What data are you trying to fit with my sinusoidal function?
In my code, there are some parts that may seem irrelevant but are nevertheless important.
The model or ‘objective’ function (that describes the process you want to model) is:
fit = @(b,x) b(1).*(sin(2*pi*x./b(2) + 2*pi/b(3))) + b(4);
the sum-of-squared-error cost function is:
fcn = @(b) sum((fit(b,x) - y).^2);
and the error minimsation function is:
[s, SSE] = fminsearch(fcn, [yr; per; -1; ym])
A 4-parameter system requires at least 4 data points to accurately model it.
If you have a different model in in mind, please describe your data, the process that produced your data, and the model you would like to apply to it. Not all modeling efforts are successful for a variety of reasons, so I will need to know how you acquired your data, and what process created it. The purpose of modeling is to identify particular parameters that, in the context of the model, describe the system dynamics.
i will be glad to help you as I can, but I need to know what you want to do.
Having a sample of your data would definitely help. This code may be appropriate for my present model or may not. We won’t know until we see it. I will need to know the process that created your data in order to develop a function that describes it, if at all possible. I will need at least as many data points as there are parameters you would like fitted to the function.
Nota Bene: I cannot guarantee that the fit will be successful. The best we can do is to give it our best effort.
Best Answer