07-31-2024 04:35 AM
I need to calculate the slope of a set of data and i want the slope to be forced to go through the zero point [0,0].
I tried the Linear fit.vi but i cant find a way to get the slope value through the zero point.
For example you can do it in excel by setting the third argument to false or 0 like in the example below.
LINEST(DataAccending!C8:C207;DataAccending!B8:B207;0)
How do i solve this in labview?
Thx.
Solved! Go to Solution.
07-31-2024 04:53 AM
You may use the General Polynomial Fit vi with polynomial order = 1 and constraining the 0 order coefficient to 0 in the Coefficient Constraint input.
07-31-2024 09:51 PM
If I had this problem, I'd start with Pen and Paper, write down the equations for least-squares to fit, then program the (very simple) algebraic calculation to get the slope of the best-fit line (the equation, of course, is y = mx). Bound to beat a "general least-squares" routine, plus the fun of "doing the math".
@toker: Were you able to get an answer by following the previous suggestions?
Bob Schor
07-31-2024 10:43 PM
It works!
Thx alot!
I also find another solution, see below.
07-31-2024 10:54 PM - edited 07-31-2024 11:00 PM
07-31-2024 11:34 PM - edited 07-31-2024 11:47 PM