我对这个问题完全迷茫了:我想绘制一些极坐标曲线。这里有一些可行的方法:
\begin{center}
\begin{tikzpicture}[xscale=1,yscale=1]
\draw[thick,->,>=latex] (-2,0)--(2.5,0) node[above] {$x$};
\draw[thick,->,>=latex] (0,-2)--(0,2) node[left] {$y$};
\draw[domain=0:540,scale=1.5,samples=500] plot (\x:{cos(\x/3)*cos(\x/3)*cos(\x/3)});
\end{tikzpicture}
\end{center}
但如果我做的几乎一样,即:
\begin{center}
\begin{tikzpicture}[xscale=1,yscale=1]
\draw[thick,->,>=latex] (-2,0)--(2.5,0) node[above] {$x$};
\draw[thick,->,>=latex] (0,-2)--(0,2) node[left] {$y$};
\draw[domain=0:3*pi,scale=1.5,samples=500] plot (\x:{cos(\x/3 r)*cos(\x/3 r)*cos(\x/3 r)});
\end{tikzpicture}
\end{center}
甚至 :
\begin{center}
\begin{tikzpicture}[xscale=1,yscale=1]
\draw[thick,->,>=latex] (-2,0)--(2.5,0) node[above] {$x$};
\draw[thick,->,>=latex] (0,-2)--(0,2) node[left] {$y$};
\draw[domain=0:3*pi,scale=1.5,samples=500] plot (\x:{cos(\x/3*180/pi)*cos(\x/3*180/pi)*cos(\x/3*180/pi)});
\end{tikzpicture}
\end{center}
最后两个不起作用。我不知道为什么 Tikz 不能接受前两个的弧度。
另外,如果有人能告诉我如何避免将余弦写成三次方,那就太好了。我尝试了几种语法,但都不起作用。
对我来说非常奇怪的是,我之前绘制了一些极坐标曲线,例如这种语法工作正常:
\begin{center}
\begin{tikzpicture}[xscale=0.5,yscale=30]
\fill[pattern=north east lines]
plot [domain=-pi/4:0,scale=3,samples=500] (\x:{-2*cos(2*\x r)/cos(\x r)})%
-- plot [domain=0:pi/4,scale=3,samples=500] (\x:{-2*cos(2*\x r)/cos(\x r)})%
-- cycle ;
\draw[thick,->,>=latex] (-8,0)--(8,0) node[above] {$x$};
\draw[thick,->,>=latex] (0,-0.05)--(0,0.15) node[left] {$y$};
\draw[thick,dotted] (6,-0.12)--(6,0.13);
\draw (-6,0) node[below left] {$-a$};
\draw (6,0) node[below right] {$a$};
\draw[domain=-pi/2.4:pi/2.3,scale=3,samples=500] plot (\x:{-2*cos(2*\x r)/cos(\x r)});
\end{tikzpicture}
\end{center}
我将非常感激您的任何评论!
答案1
使用极坐标时,角度是度数,但您提供的是弧度。使用{deg(\x)}
转换\x
为度数。对于立方体,您可以使用cos(\x r)^3
。
\documentclass[tikz,border=2mm]{standalone}
\begin{document}
\begin{tikzpicture}
\draw[thick,->,>=latex] (-2,0)--(2.5,0) node[above] {$x$};
\draw[thick,->,>=latex] (0,-2)--(0,2) node[left] {$y$};
\draw[domain=0:540,scale=1.5,samples=500] plot (\x:{cos(\x/3)^3});
\end{tikzpicture}
\begin{tikzpicture}
\draw[thick,->,>=latex] (-2,0)--(2.5,0) node[above] {$x$};
\draw[thick,->,>=latex] (0,-2)--(0,2) node[left] {$y$};
\draw[domain=0:3*pi,scale=1.5,samples=500] plot ({deg(\x)}:{cos(\x/3 r)^3});
\end{tikzpicture}
\end{document}