1. Limited time only! Sign up for a free 30min personal tutor trial with Chegg Tutors
    Dismiss Notice
Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Arcs Of Best Fit For Large Nos. of X&Y

  1. Dec 9, 2013 #1
    Hi everyone

    I was hoping someone could help with a problem I’m having.

    I am often given large amounts of X & Y data which relate to the edges of highways.
    Sometimes they are just a hand full approx 20 and other times there are approx 400.

    I use the data to find arcs that best fit the x & y data which is then used to calculate various other aspects of the highway (which I wont bore you with).

    My question is this; does anyone know of any calculators (online/excel/etc) that is available where by I can copy and paste in large rows of X&Y data and then the calculator then produces the arc of best fit i.e. the calculator should return the XY coordinates of the center of the circle and its radius.

    I am not that fussed as to how the arc of best fit is calculated i.e. may or may not use least squares, I just need something that is able to handle large rows of XY data.

    Can anyone help?
  2. jcsd
  3. Dec 9, 2013 #2


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    Well, if you just want a circle that makes sense you can do the following:

    Average the X and Y coordinates independently to get the X and Y coordinates of the center of the circle, call these [itex] X_0[/itex] and [itex] Y_0[/itex]

    For each (X,Y) data pair, calculate
    [tex] \sqrt{ (X-X_0)^2 + (Y-Y_0)^2 } [/tex]
    the distance from that point to the center of your circle. Average all of these distances, and that is the radius of your circle.

    I make no claim that this is optimal in any way, but it's probably pretty close. You should be able to make a spreadsheet in excel to do the calculations upon copy/pasting of data (with maybe a single dragging when doing the distance/averaging calculation but there's probably an excel command to avoid that)
  4. Dec 9, 2013 #3
    There is a very simple method to compute the radius and the coordinates of an arc of circle fitting a data set of points (x,y), even if the measurements are scattered : see pages 12-13 in this paper :
    It is easy to write a computer program with a mathematical software such as Matlab, Mathematica, Mathcad, etc...
    Last edited: Dec 9, 2013
  5. Dec 9, 2013 #4


    User Avatar
    Science Advisor

    As I understand the situation, the X and Y coordinates are for a segment of a circular arc. There is no guarantee that they are uniformly separated. If you average the X and Y coordinates, this will not be a good estimate for the center of the circle. Nor will it be a particularly good estimate of the center of the arc.

    One approach might be to assume that the points do not define more than about 3/4 of a circle. Start as you have outlined to determine the centroid of the sampled points. Compute the angle that each of the points make with the computed centroid, sort them and find the largest gap (modulo 360 degrees).

    Split the points at the gap and sort by angle. At this point you could assume that the center lies on the perpendicular bisector of the line connecting the two extreme points and use least squares (or similar) to determine a radius. Given a radius, you could then try to refine the estimate of the center line.

    This is all off the top of my head and may be hideously clumsy.
  6. Dec 9, 2013 #5


    User Avatar
    Staff Emeritus
    Science Advisor
    Gold Member

    I misunderstood the question, I thought it was for a full circle as opposed to just a partial arc. The question makes a lot more sense now.
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Similar Threads for Arcs Best Large
B Difference Quotient vs ARC of a Function