comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Fitting Circles
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Fitting Circles [message #18085] Wed, 01 December 1999 00:00
Vince Hradil is currently offline  Vince Hradil
Messages: 574
Registered: December 1999
Senior Member
How about doing a transformation and solving a simpler problem:

What you want to fit is r0 = [(x-x0)^2+(y-y0)^2]^(0.5)
So minimize:
r0 - [(x-x0)^2+(y-y0)^2]^(0.5)

for all pairs of (x,y). This can be done using your favorite fitting
routine (I like Craig markwardt's MPFIT... routines,
http://cow.physics.wisc.edu/~craigm/idl/idl.html)

Good luck

F.N.Hatfield@Leeds.ac.uk wrote:
>
> Dear Colleagues,
>
> I am trying to fit a circle to a set of points (x,y), and from this
> determine the centre point (x0,y0) and radius r0. It is also very
> important that I obtain the standard deviations or errors in the x0,y0
> and r0.
>
> So far, I have looked at the idl routine, curvefit.pro.
> This is a useful program but doesn't seem to allow you to pass 2
> independent variables x and y.
> I was wondering if someone has written something similar in idl,
> or could suggest a way to solve this problem.
>
> Cheers
>
> Fraser Hatfield
>
> University of Leeds, UK.
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
Re: Fitting Circles [message #18086 is a reply to message #18085] Wed, 01 December 1999 00:00 Go to previous message
Struan Gray is currently offline  Struan Gray
Messages: 178
Registered: December 1995
Senior Member
F.N.Hatfield@Leeds.ac.uk writes:

> I am trying to fit a circle to a set of points (x,y), and
> from this determine the centre point (x0,y0) and radius r0.
> It is also very important that I obtain the standard
> deviations or errors in the x0,y0 and r0.

I can see two approaches, depending on what you mean
by *the* s.d..

First, Craig Markwardt's MPFIT and associated routines are
much more useful than curvefit:

http://cow.physics.wisc.edu/~craigm/idl/

This will let you find the circle with the mimimum least
squares error w.r.t. your set of points. You can then
define a suitable region of r0,x0,y0 space and simply
calculate the least squares error for an appropriately dense
set of points. IDL's built in MOMENT routine can then be
used to extract the s.d. for each variable.

Alternately, there is a simple algebraic expression for
the unique circle passing through any three points. If you
calculate it for all permutations (warning: the number of
permutations will explode if you have lots of points) you can
generate arrays of r0, x0, and y0 values. Again, MOMENT can
then be used to extract statisics (or you can roll your own
mean and s.d. calculation).




Struan
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Troubleshooting - Error Messages.
Next Topic: WWTEXT scroll position.

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:36:55 PDT 2025

Total time taken to generate the page: 0.01211 seconds