我想使用 LaTeX 中的 TikZ 包绘制下图

我想使用 LaTeX 中的 TikZ 包绘制下图

我正在尝试使用 LaTeX 中的 TikZ 包绘制这个边缘系统(大脑连接路线)

在此处输入图片描述

虚线显示学习过程,圆圈被视为神经元。

这是我目前拥有的代码:

\newcommand{\blocwithSum}[3]{
  \begin{scope}[shift={#1}]
    \begin{scope}[every node/.style={circle, draw, minimum size=2em}]
      \node[circle, draw] [blue](#2-c1){};
      \node[below left=1em of #2-c1][red](#2-c2){};
      \node[below left=1em of #2-c2][cyan](#2-c3){};
      \node[below left=1em of #2-c3][green](#2-cn){};
      \node[below right=2em and 1em of #2-c1][blue](#2-sum){\large $\Sigma$}; %to draw the sum
    \end{scope}
    \node[above left=1em and 0em of #2-c1](#2-tt){#2};%Amygdala
    \node[draw,blue,fit=(#2-c1) (#2-c2) (#2-c3) (#2-cn) (#2-tt) (#2-sum)](#2){};%to draw the box4
    \draw[->,red,thick] (#2-c1)-|(#2-sum); \draw[->,blue,thick] (#2-c2)--++(2em,0) --(#2-sum);
    \draw[->,green,thick] (#2-c3)--++(2em,0) --(#2-sum);
    \draw[->,cyan,thick] (#2-cn)-|(#2-sum);
  \end{scope}
}

\begin{tikzpicture}
  \bloc{(0,0)}{Thalamus}
  \bloc{(4cm,0)}{Sensory Cortex}
  \blocwithSum{(9cm,0)}{Orbitofrontal Cortex}
  \blocwithSum{(1cm,-5cm)}{Amygdala}
  \foreach \ii in{1,2,3,n} {
    \node[draw][red](E\ii) at (Thalamus-c\ii-|-5,0){$S_{\ii}$};
    \draw[->,blue,thick] (E\ii)-- (Thalamus-c\ii);
    \draw[->,red,thick] (Thalamus-c\ii) -- (Sensory Cortex-c\ii);
    \draw[->,green,thick] (Sensory Cortex-c\ii) -- (Orbitofrontal Cortex-c\ii);
    \draw[->,thick] (Orbitofrontal Cortex-c\ii) -- (Amygdala-c\ii);
  }
\end{tikzpicture}

答案1

这是一个概要解决方案,我留给你去完成它。

在此处输入图片描述

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc, positioning,fit}

\begin{document}

\newcommand{\bloc}[2]{
\begin{scope}[shift={#1}]
\begin{scope}[every node/.style={circle, draw, minimum size=2em}]  
 \node[circle, draw] (#2-c1){};
 \node[below left=1em of #2-c1](#2-c2){};
  \node[below left=1em of #2-c2](#2-c3){};
   \node[below left=1em of #2-c3](#2-c4){};
 \end{scope} 
    \node[above left=1em and 0em of #2-c1](#2-tt){#2};
\node[draw,fit=(#2-c1) (#2-c2) (#2-c3) (#2-c4) (#2-tt)](#2){};
\end{scope}
 }


\newcommand{\blocwithSum}[2]{
\begin{scope}[shift={#1}]
\begin{scope}[every node/.style={circle, draw, minimum size=2em}]  
 \node[circle, draw] (#2-c1){};
 \node[below left=1em of #2-c1](#2-c2){};
  \node[below left=1em of #2-c2](#2-c3){};
   \node[below left=1em of #2-c3](#2-c4){};
   \node[below right=2em and 1em of #2-c1](#2-sum){\large $\Sigma$};
 \end{scope} 
    \node[above left=1em and 0em of #2-c1](#2-tt){#2};
\node[draw,fit=(#2-c1) (#2-c2) (#2-c3) (#2-c4) (#2-tt) (#2-sum)](#2){};
\draw[->,thick] (#2-c1)-|(#2-sum);
\draw[->,thick] (#2-c2)--++(2em,0) --(#2-sum);
\draw[->,thick] (#2-c3)--++(2em,0) --(#2-sum);
\draw[->,thick] (#2-c4)-|(#2-sum);
\end{scope}
 } 

  \begin{tikzpicture}
 \bloc{(0,0)}{Thalamus} 

  \bloc{(4cm,0)}{Sensory Cortex} 

    \blocwithSum{(9cm,0)}{Orbitofrontal Cortex} 


 \foreach \ii in{1,2,3,4} {
 \node[draw](E\ii) at (Thalamus-c\ii-|-5,0){$Kp_{1-\ii}$};
  \draw[->,thick]  (E\ii)-- (Thalamus-c\ii);
  \draw[->,thick] (Thalamus-c\ii) -- (Sensory Cortex-c\ii);
    \draw[->,thick]  (Sensory Cortex-c\ii) --  (Orbitofrontal Cortex-c\ii);  
 }

  \end{tikzpicture}   
\end{document}

相关内容