绘制二次曲面的 3D 图形

绘制二次曲面的 3D 图形

我在绘制这些二次曲面的 3D 图形时遇到了麻烦。如果有人能帮忙或给我一个可以找到相应图形代码的链接,那将非常有帮助。

双曲抛物面 在此处输入图片描述

椭圆锥 在此处输入图片描述

在此处输入图片描述

答案1

像这样吗?

\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.16,trig format plots=rad,xtick=\empty,ytick=\empty,ztick=\empty}
\begin{document}
\begin{tikzpicture}
 \matrix{
 \begin{axis}[axis lines=middle]
  \addplot3[domain=-5:5,domain y=-5:5,surf,z
  buffer=sort,shader=interp,opacity=0.5] 
  (x*x-y*y,x,y);
 \end{axis}\\
 \begin{axis}[axis lines=middle]
  \addplot3[domain=-3:3,domain y=0:2*pi,surf,z
  buffer=sort,shader=interp,opacity=0.5] 
  (x,{x*cos(y)},{x*sin(y)});
 \end{axis}\\
 \begin{axis}[axis lines=middle]
  \addplot3[domain=-3:-1,domain y=0:2*pi,surf,z
  buffer=sort,shader=interp,opacity=0.5] 
  (x,{sqrt(x*x-1)*cos(y)},{sqrt(x*x-1)*sin(y)});
  \addplot3[domain=1:3,domain y=0:2*pi,surf,z
  buffer=sort,shader=interp,opacity=0.5] 
  (x,{sqrt(x*x-1)*cos(y)},{sqrt(x*x-1)*sin(y)});
 \end{axis}\\
 };
\end{tikzpicture}
\end{document}

在此处输入图片描述

\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{width=7cm,compat=1.16,}
\begin{document}
\begin{tikzpicture}[pics/x axis/.style={code={\draw 
    (\pgfkeysvalueof{/pgfplots/xmin},0,0) -- 
        (\pgfkeysvalueof{/pgfplots/xmax},0,0);}},
    pics/y axis/.style={code={\draw 
    (0,\pgfkeysvalueof{/pgfplots/ymin},0) -- 
        (0,\pgfkeysvalueof{/pgfplots/ymax},0);}},
  /pgfplots/.cd,trig format plots=rad,hide axis,colormap/viridis]
 \matrix{
 \begin{axis}
  \addplot3[domain=-5:5,domain y=-5:0,surf,z
   buffer=sort,shader=interp]   (x*x-y*y,x,y);
  \path pic{x axis} pic{y axis};
  \addplot3[domain=-5:5,domain y=0:5,surf,z
   buffer=sort,shader=interp]   (x*x-y*y,x,y);
  \draw (0,0,0) -- (0,0,25); 
 \end{axis}\\
 \begin{axis}
  \addplot3[domain=-3:3,domain y=pi:2*pi,surf,z
   buffer=sort,shader=interp] 
   (x,{x*cos(y)},{x*sign(x)*sin(y)});
  \path pic{x axis} pic{y axis};
  \addplot3[domain=-3:3,domain y=0:pi,surf,z
   buffer=sort,shader=interp] 
   (x,{x*cos(y)},{x*sign(x)*sin(y)});
  \draw (0,0,0) -- (0,0,3);  
 \end{axis}\\
 \begin{axis}
  \addplot3[domain=-3:-1,domain y=pi:2*pi,surf,z
    buffer=sort,shader=interp] 
    (x,{sqrt(x*x-1)*cos(y)},{sqrt(x*x-1)*sin(y)});
  \addplot3[domain=1:3,domain y=pi:2*pi,surf,z
    buffer=sort,shader=interp] 
   (x,{sqrt(x*x-1)*cos(y)},{sqrt(x*x-1)*sin(y)});
  \path pic{x axis} pic{y axis};
  \addplot3[domain=-3:-1,domain y=0:pi,surf,z
    buffer=sort,shader=interp] 
    (x,{sqrt(x*x-1)*cos(y)},{sqrt(x*x-1)*sin(y)});
  \addplot3[domain=1:3,domain y=0:pi,surf,z
    buffer=sort,shader=interp] 
   (x,{sqrt(x*x-1)*cos(y)},{sqrt(x*x-1)*sin(y)});
  \draw (0,0,0) -- (0,0,{sqrt(8)}); 
 \end{axis}\\
 };
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容