LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sine decay fitting

Hello everybody,

i need to fit my data to sine decay function: V(t)=V0+V1*exp(-t0*t)*sin(w*t-phi)

i'm using Labciew 8

does anyone have an appropriate VI? 

thanks,

Etay

0 Kudos
Message 1 of 6
(3,010 Views)
Etay23-

I would suggest using the Formula Node or the MathScript Node.  For additional information on these, please take a look at the links below.  This will probably be the easiest method of implementation.

NI Developer Zone: Tutorial: MathScript and Formula Nodes
http://zone.ni.com/devzone/cda/tut/p/id/7572

NI Developer Zone: Video: Mathscript and Formula Nodes
http://zone.ni.com/devzone/cda/tut/p/id/7603

NI Developer Zone: Exercise: MathScript and Formula Nodes
http://zone.ni.com/devzone/cda/tut/p/id/7545

Regards,

Mike S
NI AE
0 Kudos
Message 2 of 6
(2,966 Views)

Hey George,

thanks for the reply.

if i understand you correcly i should use the mathscript for the fitting but in this case is need some kind of algorithem to implement in the mathscript. 

this algorithem should take some initial values and while the mathscript runs in a while loop those parameters have to change in some manner to give he best fit. 

but how to change them simultaneously?  

thanks,

Etay

0 Kudos
Message 3 of 6
(2,950 Views)

I would personally use the nonlinear fit VI with the fit function implemented as a subVI.  Once you have done it once and figured out the references and format for the f'(x,a) it is pretty easy.  See the example (I hope the 9.0 -> 8.0 save chain worked).  A majority of the BD is spent generating some fake data so I have something to fit.

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

Hello Darin,

Thanks for the Vi's .

I try to use them but no success for now 😞

I read my data from scope so I have analog  data so i took the array and connected it to the y input of the Lev-mar vi but how to connect the time stamp i.e. what should i connect to to the x input?

thanks,

etay

0 Kudos
Message 5 of 6
(2,909 Views)
Etay-

What types of values are coming from your scope?  Are they waveform data points that have a timestamp associated with them?  Or are they just simply DBL values?

If they are waveform data points with timestamps assocatied with each point, that will contain the xvalues and you can simply separate them. 

If they are simply DBL values, then there is no xvalue associated with each point.  From there you will need to develop your own xvalues based on when the scope begins taking data and the dt between each point. 
Regards,

Mike S
NI AE
0 Kudos
Message 6 of 6
(2,875 Views)