# How can I plot a 2d teardrop shape? I need a figure like the attached image but couldn't figure it out.

16 views (last 30 days)
Elif Sensoy on 5 Aug 2020
Answered: William Rose on 30 Jun 2022
KSSV on 5 Aug 2020

William Rose on 30 Jun 2022
@Elif Sensoy, an equation for a plot like yours is
where , and n is the number of teardrops, and ϕ is a phase angle that allows you to rotate things. Or you could use sine instead of cosine, and adjust the phase angle. So for the picture you gave, n=3 and .
You can plot that in Matlab using the polar plot capability, or by converting the (r,theta) pairs to (x,y) pairs using the standard polar to cartesian formulas, and then plotting the x,y pairs with Matlab's standrd plot command.
n=3; phi=-pi/6;
theta=0:pi/50:2*pi;
r=sin(n*(theta-phi)/2).^2;
x=r.*cos(theta); y=r.*sin(theta);
plot(x,y,'-r');
xlim([-1,1]); ylim([-1,1]);
axis equal
If you only want one teardrop, but you want it proportioned like the one above, then use theta=0...2*pi/3, and adust phi to make the teardrop point in the direction you want.
Try it. Good luck!

R2020a

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by