# Plot nullcline and solution trajectories of a system of ODEs with TikZ

How to get the following plot only using latex (TikZ package) of the system of differential equations:

u ’ = u (1 - u) - (a u v)/(u + d)

v ’ = b v (1 - v/u)

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

I don't need the direction fields. I can draw the nullclines as below:

\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}

• Here is an example.
– user194703
Commented Jan 20, 2020 at 16:50
• @Schrödinger'scat I have seen but unable to get plot. May I request you to help for the problem. Commented Jan 20, 2020 at 16:52

This is really just a copy of this post.

\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}

• Thank you very much.I want to join my nulcline \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}); on the same figure.. How to do that? Commented Jan 20, 2020 at 17:47