如何连接曲线上的五个点

如何连接曲线上的五个点

我正在尝试用曲线连接五个点。这是我当前的代码,但看起来不太好:

\documentclass[11pt,a5paper]{article}
\usepackage[retainorgcmds]{IEEEtrantools}
\newcommand{\cL}{\mathcal L}
\usepackage[a5paper,margin=15mm]{geometry}
\usepackage{natbib}
\usepackage{amsmath}
\usepackage{url}
\usepackage{xhfill}
\usepackage{lipsum}
\usepackage{tikz}
\begin{document}
 \begin{tikzpicture}
    \draw[very thick,<->] (-0.5,0) -- (11.0,0);%node[anchor=north west] {$x$};
    \coordinate (A1) at (1,1);
    \coordinate (A3) at (3,1.5);
    \coordinate (A5) at (5,1.9);
    \coordinate (A7) at (7,1.5);
    \coordinate (A9) at (9,1);
    \foreach \coor/\formula in {A1/{u1},A3/{u2},A5/{u3},A7/{u4},A9/{u5}} {
      \fill (\coor) circle (2pt);
      \node[below right, inner xsep=-1ex] at (\coor) {$\formula$};
      %\node[above] at (A1) {$u$};
    \draw (A1) to[in=190] (A3) to[out=10, in=210] (A5);
    \draw [out=-10](A5) to[in=200] (A7) to[ out=-10,in=200] (A9);
    }
    \end{tikzpicture}
\end{document}

答案1

如果您的意思是想用平滑的曲线连接您的点,请这样做:

\documentclass[border = 10pt]{standalone}
\usepackage{tikz}
\begin{document}
 \begin{tikzpicture}
   \draw[very thick,<->] (-0.5,0) -- (11.0,0);
   \coordinate (A1) at (1,1);
   \coordinate (A3) at (3,1.5);
   \coordinate (A5) at (5,1.9);
   \coordinate (A7) at (7,1.5);
   \coordinate (A9) at (9,1);
   \foreach \coor/\formula in {A1/{u1},A3/{u2},A5/{u3},A7/{u4},A9/{u5}} {
     \fill (\coor) circle (2pt)
       node[below right, inner xsep=-1ex] {$\formula$};
    }
    \draw[smooth] plot coordinates{(A1) (A3) (A5) (A7) (A9)};
  \end{tikzpicture}
\end{document}

平滑的曲线

TikZ 3.0.0 手册第 22.8 节中有更多内容。

相关内容