같은 점에서 결합되지 않은 두 곡선

같은 점에서 결합되지 않은 두 곡선

나는 직교 좌표에서 회전된 타원을 나타내는 두 가지 함수를 플롯하려고 했습니다. 그러나 이 두 곡선이 만나는 지점은 "결합"되거나 닫힌 것처럼 보이지 않습니다. 이 문제를 해결할 수 있는 방법이 있나요? 왜 그런지 모르겠습니다.여기에 이미지 설명을 입력하세요

코드는 다음과 같습니다.

\documentclass{article}

\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}

\begin{tikzpicture}[scale=1]
\begin{axis}[ticks=none,
axis x line=middle,
axis y line=middle,
y axis line style={<->},
xlabel=$x$,
ylabel={$y$}
]
\addplot[-] expression[line width=0.4,smooth,samples=200,domain=0:49.999] {sqrt((1.38^(2.0)-0.5^(2.0))*(50.0*(x)-(x)^(2.0)))+0.5*(x)};
\addplot[-] expression[line width=0.4,smooth,samples=200,domain=0:49.999] {-sqrt((1.38^(2.0)-0.5^(2.0))*(50.0*(x)-(x)^(2.0)))+0.5*(x)};

\end{axis}
\end{tikzpicture}

\end{document}

도와 주셔서 감사합니다,

답변1

정확한 이유는 모르겠지만 도메인을 적절하게 조정해야 할 수도 있습니다. 다음은 를 사용하는 (우아하지 않은) 해결 방법입니다 shorten.

\documentclass[border=4]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.12}
\usepgfplotslibrary{groupplots}

\begin{document}
  \begin{tikzpicture}[scale=1]
\begin{axis}[ticks=none,
axis x line=middle,
axis y line=middle,
y axis line style={<->},
xlabel=$x$,
ylabel={$y$}
]
\addplot[shorten >= -0.5ex,smooth,line width=0.4pt,samples=300,domain=0:49.99999999999999999999] {sqrt((1.38^(2.0)-0.5^(2.0))*(50.0*(x)-(x)^(2.0)))+0.5*(x)};
\addplot[shorten >= -0.5ex,smooth,line width=0.4pt,samples=300,domain=0:49.99999999999999999999] {-sqrt((1.38^(2.0)-0.5^(2.0))*(50.0*(x)-(x)^(2.0)))+0.5*(x)};
\end{axis}
\end{tikzpicture}
\end{document}

여기에 이미지 설명을 입력하세요

답변2

매개변수 변수(예에서는 t)를 사용하여 플롯을 수행할 수도 있습니다. 장점은 점이 더 고르게 분포되어 있어 더 적은 수의 샘플이 필요하고 경로를 닫을 수 있다는 것입니다( smooth cycle).

\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}

\begin{document}
\begin{tikzpicture}[scale=1]
  \begin{axis}[ticks=none,
    axis x line=middle,
    axis y line=middle,
    y axis line style={<->},
    xlabel=$x$,
    ylabel={$y$}
  ]
    \def\xzero{25}
    \def\yzero{12.5}
    \def\RotPhi{66}
    \def\RadiusA{36.5}
    \def\RadiusB{22}
    \addplot[
      line width=.4,
      smooth cycle,
      variable=t,
      samples=100,
      domain=0:360,
    ] ({
      \xzero + \RadiusA*cos(\RotPhi)*cos(t) - \RadiusB*sin(\RotPhi)*sin(t)
    }, {
      \yzero + \RadiusA*sin(\RotPhi)*cos(t) + \RadiusB*cos(\RotPhi)*sin(t)
    })
    ; 
  \end{axis}
\end{tikzpicture}
\end{document}

결과

관련 정보