Draw a Semi-Ellipse using a loop

4 views (last 30 days)
Destin Davis
Destin Davis on 9 Sep 2019
Commented: Destin Davis on 10 Sep 2019
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
Destin Davis
Destin Davis on 10 Sep 2019
I expect to see a semi-ellipse with a focus located at the origin and with the major axis in the direction of m.
Destin Davis
Destin Davis on 10 Sep 2019
It specifically has to be in polar coordinates and use the dot product of the two values. Mostly, I have to figure out how to get the while loop to work for an inequality.

Sign in to comment.

Answers (0)

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!