03-30-2008 04:48 AM
03-30-2008 03:28 PM
You are trying to fit
y(x)=a*cos(b*x)*cos(c*x)*exp(d*x)+e
with [a, b, c, d, e] as adjustable parameters. This seems like a poorly defined model, for example you will have an equally good solution swapping b and c. Also from looking at the data, d should be negative, yet you give it a large positive value as guess. Periodic functions such as "cos" (I am not sure why you use "sin" in the title of the post) are always problematic, because you can fit equally well to an alias frequency by mistake. You need to be absolutely sure about good initial guesses here. Is the model really sufficient? For example, you don't account for possibe phase.
Your file also does not contain enough significant digits, so there are multiple x values for each y. It seems however, that the x-values are linearly spaced, so it is possible to approximate the real x ramp (see attached).
Anyway, to your question. You can skip the express VI and use "nonlinear curve fit" instead. If speed is a concern, you should use the VI model, which is pretty simple in this case. (fitting takes much less than a second)
Aristofel wrote:
... I tried playing with the numbers and it seems when I put the right numbers in the function instead of using the parameters, the fitting is perfect,...
Is this synthetic or real data? As a first step, you should generate fake data with known parameters and see how well the fit does if the estimates are somewhat off.
03-31-2008 03:17 AM
04-06-2008 03:19 AM