Fitting data to a function requires two things:
Once you have that, you can just use Levenberg Marquardt. Chisquare might not be the best for (2) in 3D, you could e.g. use the sum of the square of the distance vectors between data and model. Sometimes it might help to transform the problem into a different coordiate system (spherical, cylidrical, etc.)
Also be sure to use good starting values for your parameters..
Under very specific conditions the problem can be dramatically simplified. Here's a recent discussion of the sphere fitting algorithm: http://forums.ni.com/ni/board/message?board.id=170&message.id=149402#M149402
Do you know what shape you want to fit or do you also want the program to automatically determine the shape of the object (i.e. determine if it is a cylinder or cone, then fit it accordingly)?
I have a related but considerably more simple problem, thought I would try this old post. I need to fit a set of 3D cartesian points to a plane.
This is part of a 3-D tracking system. My VI captures a set of XYZ coordinates for the movement of a tip of a medical device. However I need to calibrate the system - and I want to do that by moving the sensor through a known path (a circle) which constrains it to a plane. I then have a point cloud of XYZ data that I want to check for diameter (easy, using Fitting on a Sphere VI) and how well it fits a plane. I'll also check that each of three circles (planes) is orthogonal, but that's the easy part.
Is there a simple way to do this using the existing fitting VIs in LV? I have experimented with General LS Linear Fit and others but no solution yet. My grasp of LV is decent, but linear algebra was a long loooong time ago.
Thanks in advance, Brian
Do you have a set of typical data?
Is it a true circle or could the scaling in x, y, and z be different?
Getting the plane using general linear fit is easy unless the plane is exactly vertical. I tmight be better to work in some transformed coordinates.
Good point about applying a transformation - now I know I am thinking through the problem correctly. If the calibration target happened to be perfectly aligned with the machine's - this would give infinite slopes in two planes. A transformation takes care of that - in my case I don't care what the machine's CS is, I only need to know if it's reading my calibration target as three orthogonal planes.
After some more looking on the forums, I ran across your post on 2D general polynomial fit (769834) which fit the bill perfectly after some mods to match my dataz. Thanks for the code, left kudos there.
Hi I am trying to fit a curve with two input variables and one output, z=f(x,y), where x and y are the inputs and z the output.
I have already solved this problem on matlab by using sftool function, however I must consistenly migrate data from Labview to Matlab and this is annoying.
the general form of the model is
a,b,c and d are coefficients to be determined by the fit. atanh is the inverse hyperbolic funcion (tanh-1). I red the post about "Fitting on a sphere" but it does not seem to help me
any help would be thanked.
I want to fit a 3dimentional circle as well as cone with the help of set of co-ordinate points. Is it possible with the lab view software.