Draw a Semi-Ellipse using a loop
4 views (last 30 days)
Show older comments
I would like to draw a semi-ellipse using dot products and a loop. I want to use the dot product of the x-value and the m-value to draw it (specifically where the dot product of x and m is greater than the given eccentricity e), but I can't get the while loop to draw the ellipse in polar coordinates. Let me know if you need me to explain any of the variables.
function polar_refracted_ellipse_dotted(t,e,m)
x=0:.01:2*pi;
x_dot_m=cos(x)*cos(m)+sin(x)*sin(m);
r=(t)./(1-e.*x_dot_m);
clf;
while x_dot_m>e
for m_value=(m:pi/12:2*pi+m)
new_m_dot_old_m=cos(m_value).*cos(m)+sin(m_value).*sin(m);
r_1=(t)./(1-e*new_m_dot_old_m);
r_2=(0:0.01:r_1);
new_theta=m_value.*(r_2./r_2);
polarplot(r)
hold on
polarplot(new_theta,r_2)
rlim([0 t*6])
end
end
5 Comments
Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements 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!