如何使曲线与直线相交多次?

如何使曲线与直线相交多次?

我需要创建一个如下的图表:

在此处输入图片描述

我不知道如何创建您在案例 1 中看到的红线,以便它多次穿过蓝线。

这是我目前得到的。

\documentclass[]{standalone}

\usepackage{tikz} % To plot almost everything.
\usetikzlibrary{arrows,calc, patterns, positioning, shapes.geometric, decorations.pathreplacing,decorations.markings}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{textcomp}

\begin{document}

\begin{tikzpicture}[scale=0.8]
\scriptsize

\draw (0,0) -- (3.3,0);
\draw (0,-0.75) -- (0,3);
\node [right] at (3.3,0) {$m$};
\node [left] at (0,3) {};
\draw [blue] (0.05,2.75) to [out=270,in=180] (3.2,-0.2);
\draw [fill] (0.155,2) circle [radius =0.05];
\draw [fill] (0.52,1.2) circle [radius =0.05];
\draw [fill] (1.1,0.55) circle [radius =0.05];
\draw [fill] (1.8,0.11) circle [radius =0.05];
\node [below] at (1.9,-1) {\small Case 1};

\draw [xshift=5.1cm] (0,0) -- (3.3,0);
\draw [xshift=5.1cm] (0,-0.75) -- (0,3);
\node [xshift=4.1cm][right] at (3.3,0) {$m$};
\draw [xshift=5.1cm,blue] (0,1.8) to [out=290,in=180] (3.1,0.05);
\node [xshift=4.2cm,blue,above] at (3.1,0.0) {$u_2$};
\draw [xshift=5.1cm,red] (0,2.83) to [out=290,in=182] (3.1,0.55);
\node [xshift=4.2cm,red,above] at (3.1,0.5) {$\gamma u_1$};
\node [xshift=4.1cm, below] at (1.9,-1) {\small Case 2};

\draw [xshift=10.2cm] (0,0) -- (3.3,0);
\draw [xshift=10.2cm] (0,-0.75) -- (0,3);
\draw [xshift=10.2cm,red] (0,1) -- (3,1);
\node [xshift=8.2cm,red] at (3.3,1) {$\gamma u_1$};
\draw [xshift=10.2cm,blue] (0,2.5) to [out=290,in=170] (3.1,0.15);
\node [xshift=8.2cm,blue,above] at (3.1,0.15) {$u_2$};
\draw [xshift=10.2cm,fill] (1.03,1) circle [radius =0.05];
\node [xshift=8.2cm][right] at (3.3,0) {$m$};
\node [xshift=8.2cm,below] at (1.9,-1) {\small Case 3};

\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

您已经指定了红色曲线与蓝色曲线的交点。因此,您可以简单地在曲线中使用它们。

在此处输入图片描述

\documentclass[tikz,border=3.14pt]{standalone}

\begin{document}

\begin{tikzpicture}[scale=0.8]
\scriptsize

\draw (0,0) -- (3.3,0);
\draw (0,-0.75) -- (0,3);
\node [right] at (3.3,0) {$m$};
\node [left] at (0,3) {};
\draw [blue] (0.05,2.75) to [out=270,in=180] (3.2,-0.2);
\draw [fill] (0.155,2) circle [radius =0.05];
\draw [fill] (0.52,1.2) circle [radius =0.05];
\draw [fill] (1.1,0.55) circle [radius =0.05];
\draw [fill] (1.8,0.11) circle [radius =0.05];
\draw [red] (0.05,2.75) to [out=270,in=180] (0.155,2)
to[out=0,in=90] (0.52,1.2) to[out=-90,in=180] (1.1,0.55) to[out=0,in=90] 
(1.8,0.11) to[out=-90,in=180] (3.2,-0.2);
\node [below] at (1.9,-1) {\small Case 1};

\draw [xshift=5.1cm] (0,0) -- (3.3,0);
\draw [xshift=5.1cm] (0,-0.75) -- (0,3);
\node [xshift=4.1cm][right] at (3.3,0) {$m$};
\draw [xshift=5.1cm,blue] (0,1.8) to [out=290,in=180] (3.1,0.05);
\node [xshift=4.2cm,blue,above] at (3.1,0.0) {$u_2$};
\draw [xshift=5.1cm,red] (0,2.83) to [out=290,in=182] (3.1,0.55);
\node [xshift=4.2cm,red,above] at (3.1,0.5) {$\gamma u_1$};
\node [xshift=4.1cm, below] at (1.9,-1) {\small Case 2};

\draw [xshift=10.2cm] (0,0) -- (3.3,0);
\draw [xshift=10.2cm] (0,-0.75) -- (0,3);
\draw [xshift=10.2cm,red] (0,1) -- (3,1);
\node [xshift=8.2cm,red] at (3.3,1) {$\gamma u_1$};
\draw [xshift=10.2cm,blue] (0,2.5) to [out=290,in=170] (3.1,0.15);
\node [xshift=8.2cm,blue,above] at (3.1,0.15) {$u_2$};
\draw [xshift=10.2cm,fill] (1.03,1) circle [radius =0.05];
\node [xshift=8.2cm][right] at (3.3,0) {$m$};
\node [xshift=8.2cm,below] at (1.9,-1) {\small Case 3};

\end{tikzpicture}
\end{document}

我还删除了所有不必要的包和 TiZ 库。我对两件事感到疑惑。首先,您使用得xshift非常多。我个人会使用示波器。其次,您是如何获得第一条曲线上的那些点的?使用 可能更容易获得它们decorations.markings

答案2

您可以使用具有明确公式的图并在其上放置一点正弦。然后您可以使用交叉点库来查找交叉点。

\documentclass[tikz]{standalone}
\begin{document}
\begin{tikzpicture}
\draw (0,0) -- (3.3,0);
\draw (0,-0.75) -- (0,3);
\node [right] at (3.3,0) {$m$};
\node [left] at (0,3) {};
\draw [red, thick] plot[domain=0.:2.5, samples=41] (\x,{-0.2+2*exp(-1.5*\x)});
\draw [blue] plot[domain=0.:2.5, samples=101] (\x,{-0.2+2*exp(-1.5*\x+0.2*sin(10*\x r)});
\end{tikzpicture}
\end{document}

在此处输入图片描述

我会使用pgfplots这些图表来代替。

相关内容