LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

area/surface regression with labview

Hallo,

i need to fit an area into some xyz-points listed in a two dimensional array (dim 1: x, y, z; dim 2:point 1,2,3,..). i didn't find an appropriate sub-vi. one solution could be the minimization of the following function which describes the variation of the area-fit to N measured points: Sum[i=0,N](Zi - (a Xi + b Yi + c))^2 where Xi, Yi, Zi are the Coordinates of Point i and a, b, c are the fit-coefficents. Same problem here, i cant find a proper vi.

Can anyone help me solving this problem?

Best regards

W. Greger
0 Kudos
Message 1 of 7
(3,651 Views)
Have a look at my example ( 3DPolyFitFULL3D_12.llb) posted in this earlier thread (see also the initial discussion). It should be easy to modify it for your purpose.
 
Let me know if you get stuck. 🙂
There is also a simpler example from last year, see this old post for links .

Message Edited by altenbach on 11-23-2005 02:27 PM

Message 2 of 7
(3,643 Views)
thank you altenbach. i have some basic problems understanding your vi and subvi. the used fitting vis (general ls and levenberg) are for 2d data, i want to fit unsorted 3d-data (x,y,z) with a 3d function (3 coefficents a,b,c). can you please explain the basics of your vi in detail.

best regards

w. greger
0 Kudos
Message 3 of 7
(3,637 Views)
No, my data is 3D (x,y,z). Don't get confused by the terminology! I only count the number of independent variables: z=f(x,y), so all points are in 3D). 😄
 
It does not matter if the points are sorted or not. You should be able to use my XuFit example with only minor modifications. Note that I overload the x input to transfer both X and Y to the model subVI.
 
In your case you would slice out the x, y, and z rows from your data array (each as 1D arrays), interleave the x and y array for the [X] input and wire the z array to the [Y] input of the fitting subVI. Now you just have to rewrite the model function and adjust the number of fitting paramters. You probably want to change the display to a 3D graph, similar to my polyfit example quoted above. To make it pretty, you could even generate a full surface using the fit results.
 
Try it!
 
If you want, attach some sample data and I'll try too. 😄
Message 4 of 7
(3,627 Views)

..thank you for your great support. i have modified the calc_z_array.vi using the following function: z = a x + b y + c but i still have problems fitting the measured data. i have attached an example file "xyz-example.vi" which includes some measured xyz points. if i try to fit this data i always get the error code: 20003.

is there any suggestion why the fitting goes wrong?

 

best regards

w. greger

Message Edited by w_greger on 11-25-2005 04:19 AM

0 Kudos
Message 5 of 7
(3,617 Views)

...it seems that the reason was bad initial values. i will report later.

 

best regards

 

w. greger

0 Kudos
Message 6 of 7
(3,614 Views)

ok, now everything works fine (the reason was bad initial values as i metioned it above). thank you for this great vi!!!!!!

 

best regards

0 Kudos
Message 7 of 7
(3,608 Views)