11.7 Conics in Polar Coordinates

The code snippet below illustrates the use of the polar command to plot the polar equation ${\displaystyle r = \frac{1}{1+\cos{\theta}}}$ in MATLAB. (Notice that this is an equation for a parabola, an unbounded figure that cannot be graphed in its entirety. We don't want to include points with very large $r$ values, so we don't want to let the denominator get very close to 0. This is turns means we don't want to let $\cos{\theta}$ get too close to -1. This is accomplished by letting $\theta$ vary in the interval ${\displaystyle [\frac{-3\pi}{4}, \frac{3\pi}{4}]}$ rather than $[-\pi, \pi]$.)

>> th = -3*pi/4:.01:3*pi/4; >> r = 1./(1+cos(th)); >> polar(th, r)