如何使用 Tikz 绘制以下示意图?

如何使用 Tikz 绘制以下示意图?
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
\begin{document}
\tikzstyle{block} = [draw, fill=white, rectangle, 
    minimum height=3em, minimum width=6em]
\tikzstyle{sum} = [draw, fill=white, rectangle, node distance=1cm]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]

\begin{tikzpicture}[auto, node distance=2cm,>=latex']
\node [input, name=input] {};
\node [sum, right of=input] (sum) {S};
\node [block, right of=S] (E) {E};
\node [block, right of=E] (I) {I};
\node [block, above of=I] (J) {J};
\node [block, below of=J] (T) {T};

\node [output, below of=S] (output) {};
\node [output, below of=E] (output) {};
\node [output, below of=I] (output) {};
\node [output, right of=J] (output) {};
\node [output, right of=T] (output) {};

\draw [draw,->] (input) -- node {$A$} (S);
\draw [draw,->] (input) -- node {$\Lambda$} (S);
\draw [->] (S) -- node[name=$m \beta \left( \frac{I+l J}{N}  \right)$] {$m \beta \left( \frac{I+l J}{N}  \right)$} (E);
\draw [->] (S) -- node[name=$(1-m) \beta \left( \frac{I+l J}{N}  \right)$] {$m \beta \left( \frac{I+l J}{N}  \right)$} (I);
\draw [->] (E) -- node[name=k] {$k$} (I);
\draw [->] (I) -- node[name=n] {$k$} (J);
\draw [->] (I) -- node[name=$r_1$] {$r_1$} (T);
\draw [->] (J) -- node[name=$r_2$] {$r_2$} (T);
\draw [->] (T) -- node[name=$q\delta$] {$q\delta$} (E);
\draw [->] (T) -- node[name=$(1-q)\delta$] {$q\delta$} (S);

\draw [->] (s) -- node [name=$\mu$] {$\mu$}(output);
\draw [->] (E) -- node [name=$\mu$] {$\mu$}(output);
\draw [->] (I) -- node [name=$\mu+d_1$] {$\mu$}(output);
\draw [->] (J) -- node [name=$\mu+d_2$] {$\mu$}(output);
\draw [->] (T) -- node [name=$\mu$] {$\mu$}(output);

\end{tikzpicture}
\end{document}

在此处输入图片描述

答案1

除草后,我到达

\documentclass[tikz,border=3.14mm]{standalone}
\usetikzlibrary{positioning}
\begin{document}

\begin{tikzpicture}[auto, node distance=2cm,>=latex,block/.style={draw, fill=white, rectangle, 
    minimum height=3em, minimum width=6em}]
 \node[block] (S) {S};
 \node[block, right=of S] (E) {E};
 \node[block, right=of E] (I) {I};
 \node[block, above right=of I] (J) {J};
 \node[block, below right=of I] (T) {T};
 %
 \draw[->] (S) -- ++ (0,2) -| node[pos=0.25,above]{$(1-m) \beta \left( \frac{I+l J}{N}  \right)$} (I); 
 \draw[->] (S) -- node[pos=0.5,below]{$m \beta \left( \frac{I+l J}{N}\right)$}(E);
 \draw[->] (E) -- node[pos=0.5,above]{$k$} (I);
 \draw[->] (E.90) -- ++ (0,0.5) node[right] {$\mu$};
 \draw[->] (I.20) -- node[pos=0.5,above,sloped] {$n$} (J.180);
 \draw[->] (I.-20) -- node[pos=0.5,below,sloped] {$r_1$} (T.180);
 \draw[->] (J) -- node[pos=0.5,right] {$r_2$} (T);
 \draw[->] (T.-135) -- ++ (0,-1) -| node[pos=0.25] {$q\delta$} (E);
 \draw[->] (T.-45) -- ++ (0,-2) -| node[pos=0.25] {$(1-q)\delta$} (S.-45);
 \draw[->] (S.-135) -- ++ (0,-1) node[below]{$\mu$};
 \draw[<-] (S.160) -- ++ (-1,0) node[left] {$\Lambda$};
 \draw[<-] (S.200) -- ++ (-1,0) node[left] {$A$};
 \draw[->] (T.0) -- ++ (1,0) node[right]{$\mu$};
 \draw[->] (J.0) -- ++ (1,0) node[right]{$\mu+d_2$};
\end{tikzpicture}
\end{document}

在此处输入图片描述

笔记:

  1. \tikzstyle已被弃用。
  2. 箭头库也是如此。
  3. 以及您使用的定位语法。
  4. 您不能给节点姓名这是一个公式。
  5. 赋予不同的节点相同的名称并不是特别有用。
  6. 此代码可以进一步优化。这是在优雅与非常明确且更易于理解之间做出的妥协。

相关内容