使用 TikZ 绘制微分方程组的零斜线和解轨迹

使用 TikZ 绘制微分方程组的零斜线和解轨迹

如何仅使用微分方程组的 latex(TikZ 包)获得以下图:

u ' = u (1 - u) - (auv)/(u + d)

v ' = bv (1 - v/u)

a=1,b=0.2,d=0.25。

我不需要方向场。我可以按如下方式绘制零斜线:

\documentclass[tikz]{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
      \draw[->] (0,0) -- (1,0) node[right] {$u$};
      \draw[->] (0,0) -- (0,1) node[above] {$v$};
      \draw[scale=1,domain=0:1,smooth,variable=\x,blue] plot ({\x},{-(-1+\x)*(\x+0.25)/1});
      \draw[scale=1,domain=0:1,smooth,variable=\x,red]  plot ({\x},{\x});
                        \end{tikzpicture}
\end{document}

在此处输入图片描述

在此处输入图片描述

答案1

这实际上只是这个帖子

\documentclass[border=3mm,tikz]{standalone}
\begin{document}
\begin{tikzpicture}[declare function={du(\u,\v)=\u*(1 - \u) - (a*\u*\v)/(\u + d);
    dv(\u,\v)=b*\v*(1 - \v/\u);
    a=1;b=0.2;d=0.25;
    },scale=2.5,>=stealth]
      \draw[->] (0,0) -- (1,0) node[right] {$u$};
      \draw[->] (0,0) -- (0,1) node[above] {$v$};
      \draw[scale=1,domain=0:1,smooth,variable=\x,blue] plot ({\x},{-(-a+\x)*(\x+d)/a});
      \draw[scale=1,domain=0:1,smooth,variable=\x,red]  plot ({\x},{\x});   
      \pgfmathsetmacro{\tmin}{0}
      \pgfmathsetmacro{\ustart}{0.2}
      \pgfmathsetmacro{\vstart}{0.8}
      \pgfmathsetmacro{\stept}{0.01}
      \pgfmathsetmacro{\nextt}{\tmin+\stept}
      \pgfmathsetmacro{\nextnextt}{\tmin+2*\stept}
      \pgfmathsetmacro{\tfin}{50}
      \xdef\lstX{(\ustart,\vstart)}
      \pgfmathsetmacro{\myu}{\ustart}
      \pgfmathsetmacro{\myv}{\vstart}
      \foreach \TT in {\nextt,\nextnextt,...,\tfin}
      {\pgfmathsetmacro{\myu}{\myu+du(\myu,\myv)*\stept}
      \pgfmathsetmacro{\myv}{\myv+dv(\myu,\myv)*\stept}
      \xdef\myu{\myu}
      \xdef\myv{\myv}
      \xdef\lstX{\lstX (\myu,\myv)}
      }
      \draw[blue,thick] plot[smooth] coordinates {\lstX};
      \draw ([xshift=-1ex,yshift=-1ex]current bounding box.south west)
       rectangle  ([xshift=1ex,yshift=1ex]current bounding box.north east);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容