LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Fit 2D data in to Circle

The linear algebra involved in the circle fit apparently cannot handle the huge number of data points you are trying to fit.
0 Kudos
Message 21 of 30
(3,171 Views)

Actually, it's not the number of data points, but something else. Thye fit works fine if you multiply the x values with e.g. 10. Seems the current data causes some conditioning problems.

 

(btw: I prefer to work with complex data for xy, makes things easier to wire. See attached;))

 

 

 

 

0 Kudos
Message 22 of 30
(3,169 Views)

Sorry, of course your data is NOT a circle, but an ellipse. The circle fit is inappropriate for your data.

 

You need to fit to an ellipse, which has more parameters (A and B vs. R)

0 Kudos
Message 23 of 30
(3,162 Views)

Your background data is definitely not an ellipse either. I did a quick Levenberg-Marquardt fit to an ellipse and it does not do better than a second order polynomial.

 

If you are only intererested in the narrow spikes, you need at least a polynomial order of 10 unless you have a better mathematical model for the background.

 

Message Edited by altenbach on 10-15-2008 01:48 PM
Download All
Message 24 of 30
(3,149 Views)

Thanks AB,

 

not sure why the circle fit isn't working b/c the data is a partial trace of a precision sphere used to calibrate contour measuring instruments. Maybe the data set is too small and the form of the circle isn't apparent.

 

I'm going to look for a large set of data that encompasses more of the spheres form; i.e. something like a hemisphere.

 

Oh man this is driving me nuts...

 

The main problem I've had with using higher order polynomials is they convolute or eliminate the true waviness of the article being measured which is useful in some ways (i.e. in measuring very small features ~10's of nm's) but not so when looking at waviness.

 

In this instance sphere waviness is what I'm looking so the circle fit should be the way to go.

 

I'll post better data of a sphere in a bit...

 

thanks for your help

 

best

SS

0 Kudos
Message 25 of 30
(3,139 Views)

SurfaceSurfer wrote:

not sure why the circle fit isn't working b/c the data is a partial trace of a precision sphere used to calibrate contour measuring instruments. Maybe the data set is too small and the form of the circle isn't apparent.


Could it be that x and y are scaled differently or in different units? Your data is clearly is NOT a circle. Your data is 0.8 high, but only 0.4 wide.

 

If you look at your data on a square grid, you can see that the red cicle is the best fit to the data. You can only improve the fit by making A smaller and B larger, i.e. making it an ellipse and no longer a circle.

 

Message Edited by altenbach on 10-15-2008 02:34 PM
Message 26 of 30
(3,136 Views)

Ahhhhhha...I goofed on the data! Smiley Surprised

 

At least that brings back some sanity

 

The raw data attached is guaranteed to be from a precision sphere (radius = 21.995 mm)

 

Sorry, there are a large number of data points.

 

I also included a couople of pics for reference

 

best

SS

 

 

 

 

0 Kudos
Message 27 of 30
(3,123 Views)

OK, now the circle fit has no problems at all. 🙂

 

 

Message Edited by altenbach on 10-15-2008 04:28 PM
Message 28 of 30
(3,107 Views)

SurfaceSurfer wrote:

The raw data attached is guaranteed to be from a precision sphere (radius = 21.995 mm)


OK, the circle fit says the sphere is 21.730mm is this good enough? The difference between fit and data is mostly much less than 0.01mm (see right y-axis).

 

 

Here's a quick draft. Since x is regularly spaced, we don't need an xy graph.

 

Message Edited by altenbach on 10-15-2008 04:51 PM
Download All
Message 29 of 30
(3,100 Views)

Sweet, I've been working on subtracting the irrational numbers and was getting really weird spiral like curves! Never worked with them before so that helped quite alot!

 

The background subtracted one you show looks right on target of spec....thats really great

 

As far as I can telll the radius fit is probably slightly off because of the limited data; likely just means need to acquire more points over the entire circumference so there's no worries there.

 

I need to review what you did b/c its right on the money...also, the dual plot is pretty useful for seeing whats going on. Good idea. 

 

Anyway, thanks for the help and passing along the tips/tricks!

 

best

SS

0 Kudos
Message 30 of 30
(3,086 Views)