LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

non linear curve fit

I have a set of data that I am fitting to a sin function.  I need to find the best fit constants for my data, so I am using the non linear curve fit VI.  One of the necessary inputs for this VI is the function f(x,a) that I am fitting the data to [a, a2, a3... are the various parameters].  All of the documentation that I have come across is horrible.  Could someone show me an example of how to define a function for this input?  For my case, I just want a simple sine function with 3 variables to guess for, but any example function would be fine.

 

Thanks

0 Kudos
Message 1 of 4
(2,905 Views)

Here is my code so far.  The SineFunctioin referance vi is from when I was trying to use the Nonlinear Curve Fit VI by defining f(x,a) as a VI instead of as a formula string.  However, I can not get either meathod to actually work.

Download All
0 Kudos
Message 2 of 4
(2,901 Views)

The example finder has a few examples. Else you could also start here. Let me know if you have any questions.

 

Are you trying to use the formula model or the VI model version?

 

Of course to fit a sine, a FFT based approach might be simpler unless you have only a small fractional number of cycles. Have you tried "extract single tone", for example?

0 Kudos
Message 3 of 4
(2,900 Views)

Try this ...

 

(Make sure you select the "VI model" polymorphic instance and also make the static VI reference strictly typed.)

Download All
0 Kudos
Message 4 of 4
(2,893 Views)