LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

parallel lines fitting

Solved!
Go to solution
HI all,

I have a series of X,Y coordinates that describe n parallel lines (3 parallel lines at the moment but can get larger). Is there an easy way to get the best fit of these parallel lines, ie slopes of the lines are the same and only the intercept is different. MATLAB has a routine called aoctool that can fit parallel lines, is there an analogue in LabVIEW? Using LabVIEW 8.2 full development version.

Regards,

Leeser.
0 Kudos
Message 1 of 3
(3,273 Views)
Solution
Accepted by topic author Leeser
You can use the General LS Linear Fit.vi to implement this.  Take a look at the attached VI and see if this works for you.
The first column of the H matrix is the concatenation of all the X values for all the lines.  The rest of the columns are just 1 for those X values in that line, and 0 for the X values that are not part of the line.


-Jim
Message 2 of 3
(3,250 Views)
    Hi Jim,

Thanks for that, works a treat. Only had to do a minor reworking of the H matrix and Y input to remove extraneous (?) points on lines ie as each line did not have the same number of points for fitting had to remove all instances of coordinates (0,0). As my coordinates come from an image with a 1 pixel border there will not be a (0,0) point so this will not be a problem going forward!

Again, many thanks.


Leeser
0 Kudos
Message 3 of 3
(3,230 Views)