% 3 circles

%% Circle characteristics
r = 2; % Radius
a = 1; % Center, x and y resp.
b = 1; 

%% 1
% Pythagora's formula r^2=x^2+y^2, describing every point lying r=1 from the center.
% The presence of a square root means there are two solutions (negatives of each other).
subplot(1,3,1)

x = -r+a:pi/50:r+a; % Function domain defined by radius and x offset a.
y = sqrt(r^2-(x-a).^2);

plot(x,b+y) % y offset added after function computed.
hold on
plot(x,b-y)

grid on
axis square

%% 2
% Parametric description in terms of theta.
subplot(1,3,2)

t = 0:pi/50:2*pi;

x = r*cos(t)+a;
y = r*sin(t)+b;

plot(x,y)
grid on
axis square

%% 3
% Using complex numbers.
subplot(1,3,3)

t = 0:pi/50:2*pi;

x = r*real(exp(1i*t))+a;
y = r*imag(exp(1i*t))+b;

plot(x,y)
grid on
axis square