I have a task for school and we need to plot a polar function with MATLAB. The function is $r = 1-2\cos(6\theta)$.
I did this and I'm getting exactly the same as on Wolfram Alpha: \cos(6theta)
I've used for $\theta$ a value between $0$ and $2\pi$. Now the question explitictly says we need to take into account the period and the domain of the function and we can use the logic function $r>0$ for this. But I didn't do this because I just took a value between $0$ and $2\pi$ for $\theta$. Am I doing something wrong here?
Thanks.
$\endgroup$2 Answers
$\begingroup$As the function $r$ has period $\frac\pi3$, the curve is invariant by rotations of angle $\frac\pi 3$. Hence you have to draw a petal of the curve for $0\le\theta\le\frac\pi 3$, and deduce the five other petals by successive rotations.
$\endgroup$ 1 $\begingroup$Matlab code:
clear all close all nPoints = 500; % Number of points for the plot theta = linspace(0, 2*pi, nPoints); % Define the theta points r = 1 - 2*cos(6*theta); % Evaluate the radius for each theta x = r.*cos(theta); % Evaluate x for each theta y = r.*sin(theta); % Evaluate y for each theta plot(x,y) % Plot it!!!Output: a nice flower!
$\endgroup$ 4