LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

y = mx + c

I am using LV6.0. Normally I take the data from the LV program and put it into an excel program to find the equation of the line, for example y = 2x + 10. Can labview find the equation of the line in the graph?
0 Kudos
Message 1 of 7
(5,335 Views)
I don't know if there is a function to do this, but you can write your own.  In the equation y=mx+c, m is the slope of the line and c is the y-intercept (the y value when x=0).  You can take any two data points, (X1,Y1) and (X2,Y2) to find the slope.  M = (Y2-Y1)/(X2-X1).  Now find a point where x=0, and c will be the y value of that point.  Now that you have m and c, you can make your equation into a string using string concat functions.
- tbob

Inventor of the WORM Global
Message 2 of 7
(5,321 Views)
Look for "linear fit" or "linear fit coefficients" in the "advanced..Mathematics..curve fitting" palette. One step! 🙂
Message 3 of 7
(5,308 Views)


@labview1958 wrote:
I am using LV6.0. Normally I take the data from the LV program and put it into an excel program to find the equation of the line, for example y = 2x + 10. Can labview find the equation of the line in the graph?

1958,

1) If you have the Full or Professional version of LV6, you will have "Linear Fit.vi"  (Functions>Math>Curve Fitting>Linear Fit).  If you have the Base package it won't be there, but ...

2) If you search this forum, you will find probably find a few VI's posted from a time when LV6.0 was new that do the same job which can be used with the Base package.  An v6.0.2 example is the one by Mikael Garcia here:
http://forums.ni.com/ni/board/message?board.id=170&message.id=26936&requireLogin=False

 

=====================================================
Fading out. " ... J. Arthur Rank on gong."
Message 4 of 7
(5,309 Views)
The regression function does exactly what you want. In LV7.1 it is located at Analyze >> Mathematics >> Curve Fitting >> Linear fit.vi. It should be in a similar location in LV 6. I did not take the time to launch 6 to check.

Lynn
Message 5 of 7
(5,305 Views)
LV 6.0 does have linear fit. But how to use it? I tried dragging "linear fit" to the graph but nothing happens. Anyway?
0 Kudos
Message 6 of 7
(5,271 Views)
you must wire it to the x and y values that you are using to plot your graph.  Not sure what you meant by dragging it to the graph, but it must be wired, the same as you did when you set up your graph.

Paul
Message 7 of 7
(5,267 Views)