我想重新创建图片中的双曲线。到目前为止,我已经有了开始,按照在TikZ中绘制一定偏心率的双曲线和如何绘制椭圆?, 尤其cmhughes',上一个问题的评论中的建议,但顶部椭圆缺少其上半部分。
我该如何修复此问题?我可以使用 来修复吗\addplot3
?
\begin{tikzpicture}
\def\xm{5}
\def\ym{6.5}
\def\dom{2}
%\def\ecc{1.44022}
\def\ecc{2.3}
\def\a{1}
\def\b{(\a*sqrt((\ecc)^2-1)}
\begin{axis}[scale=.8,
hide axis,
xmin=-\xm,xmax=\xm,
ymin=-\ym,ymax=\ym]
\addplot [domain=-\dom:\dom] ({\a*cosh(\x)},{\b*sinh(\x)});
\addplot [domain=-\dom:\dom] ({-\a*cosh(\x)},{\b*sinh(\x)});
\draw (0,0) ellipse (.55cm and .25cm);
\draw (0,6) ellipse (1.3cm and .3cm);
% \draw (0,-4) ellipse (1.8cm and .3cm);
\end{axis}
\end{tikzpicture}
答案1
答案2
我尝试了建议的优秀方法,但我对我的 3D 结果并不满意(到目前为止)。所以我想添加我想到的内容。
\documentclass[12pt,a4paper]{article}
\usepackage[fleqn]{amsmath}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\definecolor{whitesmokedark}{RGB}{235,235,235}
\definecolor{gainsboro}{RGB}{220,220,220}
\begin{document}
\begin{tikzpicture}
\def\xm{5}
\def\ym{10}
\def\df{3}
\def\dom{2}
%\def\ecc{1.44022}
\def\ecc{2.3}
\def\a{1}
\def\b{(\a*sqrt((\ecc)^2-1)}
\begin{axis}[scale=.8,
hide axis,
xmin=-\xm,xmax=\xm,
ymin=-\ym,ymax=\ym]
\fill[gainsboro] (0,0) ellipse (.55cm and .2cm);
\fill[whitesmokedark] (0,7.5) ellipse (2.1cm and .3cm);
\fill[gainsboro] (0,-7.4) ellipse (2.05cm and .3cm);
\addplot [domain=-\dom:\dom] ({\a*cosh(\x)},{\b*sinh(\x)});
\addplot [domain=-\dom:\dom] ({-\a*cosh(\x)},{\b*sinh(\x)});
\end{axis}
\def\xax{2.7}
\draw[dotted] (\xax,\xax - 0.4) -- (\xax,\xax + 1);
\draw[solid, ->] (\xax,\xax + 1) -- (\xax,\xax + 1.7);
\draw[solid, ->] (\xax,\xax - 0.4) -- (1.5,2);
\draw[solid, ->] (\xax,\xax - 0.4) -- (4.5,2);
\node (x) at ( \xax -0.1,\xax + 1.3) [label=right:$x$] {};
\node (y) at (1.6,1.9) [label=above:$y$] {};
\node (z) at (4.5,1.9) [label=above:$z$] {};
\end{tikzpicture}
\end{document}
如下图所示。(欢迎批评指正。)
编辑3D解决方案:
\documentclass[12pt,a4paper]{article}
\usepackage[fleqn]{amsmath}
\usepackage[usenames, dvipsnames]{color}
\usepackage{tikz}
\usepackage{pgfplots}
\pgfplotsset{compat=1.13}
\definecolor{mediumgreen}{RGB}{0,153,0}
\begin{document}
\begin{tikzpicture}[scale=1.5]
\begin{axis}[
shader=interp,
opacity=0.7,
fill opacity=0.7,
axis lines = none,
ticks=none,
axis equal
]
\draw[thick,->,black] (0,0,0) -- (4,0,0) node[anchor=north east]{$z$};
\draw[thick,->] (0,0,0) -- (-1,-6,1) node[anchor=north east]{$y$};
\draw[thick,->] (0,0,0) -- (0,0,4.3) node[anchor=east]{$x$};
\addplot3[%
shader=interp,
opacity = 0.6,
fill opacity=0.6,
surf,
colormap = {whiteblack}{color(0cm) = (mediumgreen);color(1cm) = (black)},
variable = \u,
variable y = \v,
domain = 0:180,
y domain = 0:360,
]
({cos(u)*sin(v)}, {sin(u)*sin(v)}, {.1*cos(v)});
\addplot3[surf,domain=0:360,y domain=-1.5:1.5]
({cosh(y)*cos(x)},{cosh(y)*sin(x)},{sinh(y)});
\end{axis}
\end{tikzpicture}
\end{document}