03-20-2014 12:19 PM
Hi people. How i make a VI with Linear Fit running in real-time?
03-20-2014 05:03 PM
Icaro Kossmann,
Please be specific about what you mean by "real-time." Are you running LV on one of the NI provided real-time OSes? Are you running on an FPGA? Or does "real-time" simply mean that it keeps up with what a human operator can observe?
How many data points are you trying to fit?
Some of the fitting routines have been improved substantially since LV 8.6. A 1000 point data set can be fit in ~40 us on a recent version of LV. For 100000 points it takes about 2.5 ms.
Lynn
03-21-2014 04:07 AM
(in some cases) a linear fit can be done with a FIR filter 🙂
So samplerate (&looptime) , number of points, kind of fit???
FPGAs can do FIR filter very fast 😄
03-21-2014 09:32 AM
So, this is my job: want to continously do a linear fit over acquired data sets that has to be able to keep up with the incoming data. I will acquire temperature in max 40 minutes, and i want to make a linear fit with each new temperature value durig acquisition. In real time.
03-21-2014 09:40 AM
And build equation in real time
03-21-2014 01:11 PM
If you are working with temperature over a 40 minute time scale, you should have no problem doing a linear fit as you acquire the data. As I pointed out before fitting the numbers of points you would likely have takes only a small fraction of a second.
Lynn
03-21-2014 02:08 PM
So, i got it :), but my next problem is build and show de equation from the data collected. Exist a VI for this?
03-21-2014 04:58 PM
I am not sure about LV 8.6 - that is pretty old. In the newer versions of LV the Linear Fit VI has slope and intercept outputs. Those are the coefficients needed for the standard equation of a line of the form y = m*x + b.
The fit VI also has an array of points of the values of y for each of the values of x in the input array. This can be used to plot a line of the fit without any extra work.
Lynn