楕円の代わりに双曲線。楕円の下にあるコードに注目してください。双曲線にも似たようなコードがありますか?

楕円の代わりに双曲線。楕円の下にあるコードに注目してください。双曲線にも似たようなコードがありますか?
\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}

ここに画像の説明を入力してください

関連情報