04-19-2011 09:03 AM
I can measure with a machine the coordinates (x,y,z) of some points that stay in a plane.
Can I use labview to fit the points and extract the equation of the plane in a x,y,z coordinate system?
If it were possible please help me, suggesting some example code (if existing...) or at least suggest to me which functions I should use: I even don't know where to start from.
Thanks in advance
Solved! Go to Solution.
04-19-2011 09:58 AM
How would you do it if you weren't using LabVIEW but just regular math?
From what I recall, vectors and cross products come into play in the calculations. So look at the Mathematics >> Linear Algebra palette.
04-19-2011 10:20 AM
But I need to make a best fit with a surface, a plane. The points I measure have an error and I HAVE to do a best fit.
If I measure (x,y) point staying in a line, I know hot to fit them with a line (regression fit). Now I have point in (x,y,z) space and I need to put a plane fitting them.
Is it possible to do that or not?
04-19-2011 11:06 AM
04-19-2011 11:19 AM
There is an example VI that ships with LabVIEW 2010 that may be of use to you. It is called the 'B Spline Fitting Demo'. This VI contains an implementation of a 3D curve fitting function that will smooth your (x,y,z) data. However, It will not provide you the equation that best descibes the fit.
Regards,
Dave.
02-03-2012 09:49 AM
I had the same problem,
here is a quick and dirty solution....
Regards,
Marco
02-03-2012 06:02 PM
What I actually did is to use the following algorithm which I found googling:
http://www.sbg.bio.ic.ac.uk/~islam/plane.html
It can be implemented with labview very easily.
12-31-2015 10:08 AM
gnappo, Can you post an example of the vi you used?
12-31-2015 11:28 AM
There are (at least) two ways to think about fitting a plane through a collection of data points. The reference that you provided solves the general problem of a least-squares fit when there is "uncertainty of measurement" about X, Y, and Z values.
However, in many cases, you make measurements of a (Z) value from "known" X and Y settings. Under this circumstance (which I believe is the case with what you are describing), the "unknown" quantity is X, so what you want to minimize is not the "distance to the best plane" for your cloud of X, Y, Z points, but the Z-distance to the plane. I grant that this is a subtle distinction, and in the "best of all possible worlds" will give (roughly) the same answer, but if you go to publish your work and state your methods, some sharp-eyed reviewer might pick up that you used the wrong algorithm for fitting, and might question the values of your fit.
Bob "Pedantic" Schor
01-14-2016 12:41 PM - edited 01-14-2016 12:43 PM
I am sorry for my late answer. Furthermore, you asked me something I did a long time ago. Anyway, here are the 2 files I used. They are alternative. They are subvi of a large project. However, you can make work each of them as if they were VIs. They calculate the eigenvector. You have to give the points in input in the format you like (so you should modifify all the first part according to your need in order to have the xi, yi and z)i. Unfortunately for you, I write VIs in a spaghetti-like fashion, but I think that if you have clear the formulas to use (the link I gave before) you can easily figure how it works.