Nonlinear system Circle problem

I am supposed to determine with 3 points the midpoint and the radius of a circle
clear all; close all; clf;
x=[5 8 4]'; y=[9 8 3]';
X = (x(3)-x(2))/2; Y=(y(1)-y(3))/2; R= ; p=[X Y R]';
for iter=1:5
f=[ (x(1)-X)^2+(y(1)-Y)^2-R^2
(x(2)-X)^2+(y(2)-Y)^2-R^2
(x(3)-X)^2+(y(3)-Y)^2-R^2 ];
disp(norm(f))
J=[ 2*(x(1)-X) 2*(y(1)-Y)
2*(x(2)-X) 2*(y(2)-Y)
2*(x(3)-X) 2*(y(3)-Y) ];
dp=-J\f; p=p+dp;
X=p(1); Y=p(2); R=p(3);
end, p
plot(x,y,'o')
This is my code thus far, is my X=(x(3)-x(2))/2; Y=(y(1)-y(3))/2 correct, what should 'R=' be?
Best Regards Aldo

5 Kommentare

Torsten
Torsten am 11 Nov. 2016
You have three equations in three unknowns.
How can the Jacobian for Newton's method be 3x2 in this case ?
Best wishes
Torsten.
Aldo
Aldo am 11 Nov. 2016
Yes I will change that, do you know what R= should be equal to?
Torsten
Torsten am 11 Nov. 2016
Bearbeitet: Torsten am 11 Nov. 2016
The value for R is just an initial guess.
If your guesses for X and Y are reasonable, you could initialize R as
sqrt((x1-X)^2+(y1-Y)^2) or
sqrt((x2-X)^2+(y2-Y)^2) or
sqrt((x3-X)^2+(y3-Y)^2)
Best wishes
Torsten.
Aldo
Aldo am 11 Nov. 2016
Bearbeitet: Aldo am 11 Nov. 2016
How should the Jacobian be? Shouldn't it be J_11 J_12 J_21 J_ 22. Shouldn't R be considered a constant?
Best Regards
You have three equations in the unknowns X,Y and R. Thus the Jacobian is (3x3):
[df1/dX df1/dY df1/dR
df2/dX df2/dY df2/dR
df3/dX df3/dY df3/dR]
Best wishes
Torsten.

Melden Sie sich an, um zu kommentieren.

Kategorien

Tags

Gefragt:

am 11 Nov. 2016

Kommentiert:

am 11 Nov. 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by