From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Least Squares (X,Y) point for 2D Intersection of Lines

Solved!
Go to solution

I have 6 line equations (Y=mx + b) that do not intersect at the same point.  Is there any pre-written LabVIEW code that will take the line coefficients and find me the closest intersection (x,y) point using least-squares fit?


0 Kudos
Message 1 of 3
(2,452 Views)
Solution
Accepted by topic author SeanDonner

Hi Sean,

 

this sounds like a rather simple (because of just 6 first order polynomials) algebra problem: there is a full "Linear Algebra" functions palette…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 3
(2,447 Views)

Thanks for the pointer to the "Linear Algebra" palette, inside there is a "Solve Linear Equations" VI and in the context help says "When m > n, the system has more equations than unknowns, so it is an over-determined system. Since the solution that satisfies AX = Y may not exist, the VI finds the least-square solution X, which minimizes ||AX – Y||."

 

I didn't have to do a thing other than build up the matrix and column vectors A and Y, respectively.

 

Thanks!


0 Kudos
Message 3 of 3
(2,401 Views)