雙曲線而不是橢圓。注意下面的程式碼中的橢圓,還有類似的程式碼為和誇張嗎?

雙曲線而不是橢圓。注意下面的程式碼中的橢圓,還有類似的程式碼為和誇張嗎?
\documentclass[11pt,a4paper]{article}
\usepackage{tikz}

\begin{document}

\begin{tikzpicture}[scale=1];

\draw (0,0) ellipse (5 and 3);

\end{tikzpicture}

\end{document}

答案1

這使用了該pgfplots套件和進行參數繪圖的能力。

雙曲線可以透過參數定義為

x = a*cosh(t)
y = b*sinh(t)

a 和 b 表示「長軸」和「短軸」參數。

\documentclass[11pt,a4paper]{article}
\usepackage{tikz}
\usepackage{pgfplots}




\pgfplotsset{compat=1.12,
  grid=none,
  axis lines=none,
  width=8cm,
  height=8cm,
  scale only axis,
}
\begin{document}


\begin{tikzpicture}[scale=1];

%\draw (0,0) ellipse (5 and 3);
\begin{axis}
\addplot[samples=201,domain=-1:1,variable=\t]({2*cosh(t)},{1*sinh(t)});
\addplot[samples=201,domain=-1:1,variable=\t]({-2*cosh(t)},{1*sinh(t)}); % left hyperbolic branch

\addplot[samples=201,domain=0:360,variable=\t]({5*cos(t)},{3*sin(t)}); % Draw the ellipse

\end{axis}

\end{tikzpicture}

\end{document}

在此輸入影像描述

相關內容