function RANSAC_circle

cx = 0.3;
cy = 0.5;
r = 1;
 
theta = 0:0.1:2*pi+0.1;
theta = theta';
x = cos(theta) + cx + 0.05*randn(size(theta));
y = sin(theta) + cy + 0.05*randn(size(theta));

figure(1)
clf;
plot(x,y, 'b.');
axis equal
grid on
 
nRansacIter = 500;
threshold = 0.1;
max_nInliers = 0;
%% RANSAC circle
% U: Estimated center of circle
% R: Radius

%%
hold on
plot(R*cos(theta)+U(1), R*sin(theta)+U(2), 'r-');
hold on
plot(U(1), U(2), 'rx');
hold on
plot(cx, cy, 'bx');