如何绘制甜甜圈,其图附于此处
甜甜圈看起来很漂亮。我想画出来。圆环的参数方程是
$$x = (R + a cos(p)) cos(t);$$ $$y = (R + a cos(p)) sin(t);$$ $$z = a sin(p);$$ 其中 $t,p\in [0, 2\pi]$如何做到? 编辑: 我尝试过的内容如下:
\documentclass{article}
\usepackage[margin=0.5in]{geometry}
\usepackage[utf8]{inputenc}
\usepackage{comment}
\usepackage{pgfplots}
\pgfplotsset{width=10cm, compat=1.16}
\begin{document}
\begin{tikzpicture}
\begin{axis}
[
view={60}{30},
]
\addplot3[surf,shader=interp,
domain=0:2*pi,
p domain=0:2*pi,
samples=101,
samples x=2,R=5,a=2
]
({(R + a*cos(deg(p)))*cos(deg(x))},
{(R + a*cos(deg(p)))*sin(deg(x))},{a*sin(deg(x))});
\end{axis}
\end{tikzpicture}
\end{document}