View License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
Circle fit

4.2 | 15 ratings Rate this file 147 Downloads (last 30 days) File Size: 1.83 KB File ID: #5557 Version: 1.0
image thumbnail

Circle fit



26 Jul 2004 (Updated )

Fit a circle to a set of measured x,y points.

Editor's Notes:

This file was selected as MATLAB Central Pick of the Week

| Watch this File

File Information

Revival of a 14 years old code (written in 1991 for MATLAB 2.x).

Given a set of measured x,y pairs that a re supposed to reside on a circle, but with some added noise. A circle to these points, i.e. find xc,yc,R, such that (x-xc)^2+(y-yc)^2=R^2

The method minimizes the sum of squared radial deviations.


This file inspired Aquiles, Diffract Index, Best Fit 3 D Circle To A Set Of Points, Ellipse Fit, Circle Fit (Kasa Method), Circle Fit (Pratt Method), Circle Fit (Taubin Method), and Fast Circle Fitting Using Landau Method.

MATLAB release MATLAB 5.2 (R10)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (23)
29 Nov 2016 Marlin Baidillah

10 Sep 2016 ahmet dogrusadik

19 Sep 2015 Xin

Xin (view profile)

05 Mar 2015 tejas harish

can anyone please tell what is significance of variables th,R,xe and sigma in the circlefit code?

Comment only
21 Jul 2014 Daniel Golden

10 Aug 2010 Yasmine


Does anyone know how to calculate deviation from circularity of the measured points compared to the fitted circle using this code?

Comment only
26 Apr 2010 SengChoy Liew

I have come to a death end in Image processing toolbox to evaluate the circles in a gray scale image.

Anyone how how to use the codes given to fit into those circles in the image so that an histogram for the distribution of circles diameter can be plot ?

Comment only
07 Jan 2009 Nikolai Chernov

Nikolai Chernov (view profile)

This circle fit has been first published by P.Delogne and I.Kasa in the 1970s and is known as "Kasa method" in statistics. It works well when points cover a large part of the circle but is heavily biased when points are restricted to a small arc. Better fits were proposed by Pratt and Taubin.

08 Sep 2008 Mehmet Alpay

Works like a charm :-)

31 Jan 2008 Darren Hewett

04 Dec 2007 Sebastian Laechele

Works very well!
I don't really know how, but it works! :D
You saved me a bunch of hours there.
Thank you very much!

22 May 2007 Richard Brown

Note: This code doesn't minimise the sum of squared radial deviations - that is a nonlinear least squares problem

This code minimises sum((x.^2 + y.^2 - R^2).^2)

Comment only
10 Dec 2006 Hendro Nurhadi

Just... Excellent.. thanks.

29 Sep 2006 Sanjeev Sharma

I found it to be very effective.

21 Feb 2006 shmi braun

Re: Hedi Kawano

see also

Comment only
20 Feb 2006 Luigi Rosa

High-quality code, simple and effective

21 Nov 2005 Tomaz Pepelnjak

Very useful if you need to fit measured points to the circle function and compare it further to reference value.

14 Mar 2005 Hedi Kawano

Sorry, it is
(last "t" was missing)

Comment only
14 Mar 2005 Hedi Kawano tells you that the equation used in this "circle_fit.m" gives an approximate solution.

22 Dec 2004 Knut C. Naue

Nice tool for data covering almost a complete circle. But if data exists describing only an arc, circfit fails identifying the assumed center and radius.

05 Nov 2004 Bjorn Hemming

I have used this function to verify a feature in a Metrology software giving correctly first 4 digits, so it seems OK

25 Sep 2004 Yogesh Mehta


It can be extremely useful. For example, trying to fit a nyquist plot to an experimentally acquired FRFs... Ideally, nyquist plot is supposed to be a circle, but is not due 'noise'

Comment only
18 Aug 2004 Yuri Slobo...

Can someone please enlighten me where one meets such distributions to be fitted by a circle ?

Comment only

Contact us