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

11 vues (au cours des 30 derniers jours)

Réponses (1)

William Rose
William Rose le 30 Juin 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!

Catégories

En savoir plus sur Polar Plots dans Help Center et File Exchange

Produits


Version

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by