Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Formalize the problem of fitting a circle to a noisy sample of m points on the R^2 plane (orin C, if you prefer) as a

Formalize the problem of fitting a circle to a noisy sample of m points on the R^2 plane (orin C, if you prefer) as a nonlinear least squares problem, and adapt our implementation ofthe Gauss–Newton algorithm (Gauss_Newton.m) to solve it. The input should be the set ofsample points, and the output is the center and radius of the resulting circle.

function [ xk ] = Gauss_Newton(T,Y,x0,iter)
% T,Y: paramteres for functions r and J, i.e. T: sampling points, Y: sample values
% r: R^n->R^m is the residual function of r_j entries
% J: R^n->R^{mxn} is the derivative of r, i.e. its rows are the gradients of r_j-s
% x is a local minimizer of the sum of r_j^2 -s.

rho=0.5; %For the Armijo LS; usually 0.5 or 0.9
c=0.2; %For the Armijo LS; usually 0.01 or 0.2

xk=x0;
f = @(x) 0.5*sum(r(x,T,Y).^2);
df = @(x) J(x,T)'*r(x,T,Y);
for k=1:iter
H = J(xk,T);
b = -r(xk,T,Y);
p = linear_LSq(H,b);
alpha = norm(p);
p = p/norm(p);
if sum(isnan(p)) > 0
break;
end
gamma = Armijo_LS(f,df,p,xk,alpha,rho,c);
xk = xk+gamma*p;
end
end

% example of r and J
function [ rx ] = r(x,T,Y)
rx = x(1).*sin(x(2).*T'+x(3))-Y';
end

function [ Jx ] = J(x,T)
Jx = zeros(size(T,2),size(x,1));
for j=1:size(T,2)
Jx(j,:) = [sin(x(2)*T(j)+x(3)) x(1)*cos(x(2)*T(j)+x(3))*T(j) x(1)*cos(x(2)*T(j)+x(3))];
end
end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

To formalize the problem of fitting a circle to a noisy sample of points on the 2D plane as a nonlin... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Applied Linear Algebra

Authors: Peter J. Olver, Cheri Shakiban

1st edition

131473824, 978-0131473829

More Books

Students also viewed these Programming questions

Question

Solve Problem 7.7-6 by using Mohr's circle for plane strain?

Answered: 1 week ago

Question

What does non-recourse financing mean?

Answered: 1 week ago