I need help in finding the area of the shaded region in terms of w,a,b
Getting complex value for real integration
4 views (last 30 days)
Show older comments
Mithun Kumar Munaganuri
on 31 Mar 2022
Commented: Mithun Kumar Munaganuri
on 5 Apr 2022
I'm getting complex value in real integration while trying to find area under ellipse as shown in below figure. Please advise
9 Comments
Accepted Answer
David Goodmanson
on 4 Apr 2022
Edited: David Goodmanson
on 4 Apr 2022
Hi Mithun,
One of the more straightforward methods is to forget about symbolics and just write down the solution for y. The ellipse has semimajor axis a along x, semiminor axis b along y, and is centered at
( w/2, -(b/(2*a))*sqrt(4*a^2-w^2) )
so that the ellipse passes through both the origin and (w,0). w has to be less than 2*a, the major axis. Solve the ellipse equation for y,
( y + (b/(2*a))*sqrt(4*a^2-w^2) )^2/b^2 = 1 - (x-w/2).^2/a^2
take the sqrt of both sides**, rearrange
y = -(b/(2*a))*sqrt(4*a^2-w^2) +- b*sqrt((1-(x-w/2).^2/a^2)).
** the sqrt of the left hand side is taken as positive. The sqrt of the right hand side can be either sign, but the positive sqrt is chosen since from the figure, y>=0. So
a = 3; b = 2; w = 5;
fun = @(x) -(b/(2*a))*sqrt(4*a^2-w^2) + b*sqrt((1-(x-w/2).^2/a^2));
integral(fun,0,w)
ans = 3.1468
3 Comments
David Goodmanson
on 4 Apr 2022
Hi Mithun,
you're most welcome. One thing I forgot to mention is that when you post a question it's not best practice to post images of code. It's much better to copy in the code as text. That way, people looking to assist can just copy the code and run it, rather than having to type it in by hand.
More Answers (0)
See Also
Categories
Find more on Lighting, Transparency, and Shading in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!