Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Matlab An ellipse with semiaxes a and b is specified by (x/a)2 + (y/b)2 = 1. If

ID: 670775 • Letter: M

Question

Matlab

An ellipse with semiaxes a and b is specified by (x/a)2 + (y/b)2 = 1. If r = a = b. then this defines a circle whose perimeter is given by P = 2pir. Unfortunately, if a b. then there is no simple formula for the perimeter and we must resort to approximation. Numerous possibilities have been worked out: p1 = pi (a+b) P5 = pi(a+b) (1+3 /10+ ) P2 = pi P6 = pi (a+b) 64 - 3h2/64 - 16h P3 = pi P1 = pi(a+b) 256 - 48h - 21h2 / 256 - 112h = 3h2 P4 = pi(a+b) (1 + h/8)2 P8 = pi(a+b) (3 - ) Here. h = (a-b/ a+b)2 can be regarded as a departure from "circlehood." Write a script that solicits a and b and prints the values of P,,..., P8 in a way that facilitates comparison. The value of h should also be displayed. Try input values (a, b) = (1,1), (1, .9),..., (1,. 1). What can you say about the discrepancies among the perimeter formulae as the ellipse becomes more oblong in shape?

Explanation / Answer

x = input('Enter Radius of Circle 1');
a = CircleArea(x);
disp(['Area of Circle1 = ' num2str(a)])
y = input('Enter Radius of Circle 2');
b = CircleAreay);
disp(a and b alues)
if(a !=b)
r=a/b;
disp( r value);
pei=22/7;
p1=pei(a+b)
disp('p1');
p2=pei squrt(2*(a*a)+(b*))
disp(p2);
p3=pei*(sqrt(2*(a*a)+(b*))-((a-b)*(a-b))/2)
disp('p3');
h1=(a-b)/(a+b);
h=h1*h1;
disp('h');
p41=1+(h/8);
p4=pei*p1*p41*p41;
disp('p4');
p511=3*h/((10+sqrt(4-3*h));
p51=1+p511;
p5=p1*p51;
dips('p5');
p61=(64-3*h*h)/(64-16*h);
p6=p1*p61;
disp('p6');
p71=(256-48h-h*h);
p72-(256-112h+(3*h*h));
p711=p71/p72;
p7=p1*p711;
disp('p7');
p81=((3-sqrt(1-h))/2;
p8=p1*p81
disp('p8');
else
r=a=b;
disp('r');
end