%Four estimates of the perimeter of an ellipse
%(with varying values of the minor axis)

close all

a = 1; % major semi axis
b = linspace(.1,1,100); % minor semi axis

P1 = pi*(a+b);

P2 = pi*sqrt(2*(a^2+b.^2));

P3 = pi*sqrt(2*(a^2+b.^2)-((a - b).^2)/2);

h = (a - b)./(a + b);
P4 = pi*(a + b).*(1 + h/8).^2;

plot(b,P1, b,P2, b,P3, b,P4)
xlabel('minor semi axis')
ylabel('perimeter')
legend('Method 1', 'Method 2', 'Method 3', 'Method 4')