help-octave
[Top][All Lists]
Advanced

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

Re: fitting circle to data


From: macy
Subject: Re: fitting circle to data
Date: Mon, 30 Nov 2009 20:40:27 -0800 (PST)
User-agent: SquirrelMail/1.4.13

double ARRRGGG! gone brain dead!

Given set of data, try to find x0, y0, and R that best fits data set.

define dx=xi-x0; dy=yi-y0;
error=R-sqrt(dx^2+dy^2);
solution is to minimize sum(error^2);

that keeps in the real domain, and doesn't that measure the accuracy with
an orthogonal vector while giving equal weight to accuracy?  no data point
taking precedence.


> 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




reply via email to

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