help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fitting circle to data


From: Primoz PETERLIN
Subject: Re: fitting circle to data
Date: Tue, 01 Dec 2009 09:08:41 +0100
User-agent: Thunderbird 2.0.0.14 (X11/20080501)

Hi,

The method with the squares - not the abs() - is easy to solve analitically and is known as the Delogne-Kása method. There is more to fitting a circle to a set of data points than it looks at first; Nikolai Chernov provides an excellent overview of the state of the art:

http://www.math.uab.edu/~chernov/cl/

You can also find some Matlab code there which I believe runs with Octave as well.

Best regards,
Primož

address@hidden pravi:
ARRRGGG!

that should have been
minimize the sum of the absolute values
  sum( abs(R^2-(xi-x0)^2-(yi-y))^2) )

since the error is already squared!


From my naive approach:

Given a circle or radius, R, with origin at x0 and y0:
the error for any data point is:
= R^2-(xi-x0)^2-(yi-y))^2

now you must minimize the sum of the squares:
sum( (R^2-(xi-x0)^2-(yi-y))^2)^2 );

Doing it without using sqrt function should preserve your final answers
completely in real space, right?


Hello,

i need to extract the radius and centre points of a circle fitting a
set of datas. I was trying with this way

xt = %data
yt = %data

F = @(x,p) sqrt( p(3).^2 -(x-p(1)).^2)+p(2)
pin = [1;1;1]

[f, p] = leasqr(xt,yt,pin,f);

testing it with xt = 2+4*cos(thetas) and yt = 3+4*sin(thetas) works
well,
i get
p =

   2.0000 + 0.0000i
   3.0000 + 0.0000i
   4.0000 - 0.0000i

but using the real data i get
p =

   -2.23630 -  0.62042i
   12.24122 - 64.02140i
    0.34923 + 59.63389i

and should be aprox. p = [0, 300, 290]

If i use pin =  [0; 300; 290] get
p =

    -2.2316 -   1.5828i
    12.2604 - 162.9057i
     0.3318 + 161.1838i

is that right? how souhld i use this comples result?
Thank you

PD: here a few xt and yt datas
xt =

   29.94340
   28.45820
   27.19490
   25.85900
   24.73510
   23.54580
   21.88660
   19.90880
   17.77030
   15.64780
   13.04540
   10.67190
    8.43594
    6.35659
    4.31690
    2.28645
    0.19964
   -1.74150
   -3.66550
   -5.75025
   -7.75397
...
 yt =

   13.277
   13.079
   12.952
   12.747
   12.670
   12.638
   12.475
   12.225
   12.059
   11.977
   11.773
   11.676
   11.556
   11.526
   11.454
   11.415
   11.394
   11.449
   11.444
   11.491
   11.556
...



--
Gastón Araguás
______________________________________________________
CIII - Centro de Investigación en Informática para la Ingeniería
Univ. Tecnológica Nacional Facultad Regional Córdoba. Argentina


_______________________________________________
Help-octave mailing list
address@hidden
https://www-old.cae.wisc.edu/mailman/listinfo/help-octave



reply via email to

[Prev in Thread] Current Thread [Next in Thread]