[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fitting circle to data
From: |
Gastón Araguás |
Subject: |
Re: fitting circle to data |
Date: |
Tue, 1 Dec 2009 10:45:09 -0300 |
Thank you very much to all. This code is working well now:
xt = %data
yt = %data
F = @(x,a) (xt-a(1)).^2+(yt-a(2)).^2-a(3).^2
pin = [1;1;1];
[f , p] = leasqr(xt,yt,pin,F);
p =
8.2224e-02
2.4914e+02
2.3772e+02 <---- r
on the other hand this linear version gives good results too, without
initializations (thanks to Richardson)
A = [ xt yt ones(size(xt))];
b = xt.^2 + yt.^2;
c = A\b;
r = sqrt(c(3) + c(1)^2 + c(2)^2);
r = 238.25
I'm not sure wich of them is the best result, I'll try to test it with
real and artifcial data
Thank you all again
--
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