代码:
\documentclass[UTF8]{ctexart}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\begin{document}
\thispagestyle{empty}
% 定义基本形状
\tikzstyle{results}=[ellipse ,text centered,draw=black]
\tikzstyle{textareas} =[rectangle, rounded corners,text centered]
\tikzstyle{inoutput} =[ellipse,draw=black]
% 箭头形式
\tikzstyle{arrow} = [<-,>=stealth]
\begin{tikzpicture}
%定义具体形状和相关位置
\node[textareas](rootnode){};
\node[inoutput,below of=rootnode,yshift=-0.5cm](output){};
\node[textareas,below of=rootnode,yshift=-0.5cm,xshift=0.8cm,font=\small](outputtext){阈值$0.5$};
\node[textareas,below of=output,yshift=-0.5cm,xshift=1.8cm,font=\small](outputtext){阈值$0.5$};
\node[textareas,below of=output,yshift=-0.5cm,xshift=-1.8cm,font=\small](outputtext){阈值$0.5$};
\node[inoutput,below of=output,yshift=-0.5cm,xshift=-1cm](inputx1){};
\node[inoutput,below of=output,yshift=-0.5cm,xshift=1cm](inputx2){};
\node[inoutput,below of=inputx1,yshift=-0.5cm](inputx3){};
\node[inoutput,below of=inputx2,yshift=-0.5cm](inputx4){};
\node[textareas,below of=inputx3,yshift=0.5cm,font=\small](outputtext){$x_1$};
\node[textareas,below of=inputx4,yshift=0.5cm,font=\small](outputtext){$x_2$};
%连接形状
\draw [arrow] (rootnode) -- node [left,font=\small] {$y$} (output);
\draw [arrow] (output) -- node [left,font=\small] {$1$} (inputx1);
\draw [arrow] (output) -- node [right,font=\small] {$2$} (inputx2);
\draw [arrow] (inputx1) -- node [left,font=\small] {$1$} (inputx3);
\draw [arrow] (inputx1) -- node [right,font=\small] {$-1$} (inputx4);
\draw [arrow] (inputx2) -- node [left,font=\small] {$-1$} (inputx3);
\draw [arrow] (inputx2) -- node [right,font=\small] {$1$} (inputx4);
\end{tikzpicture}
\end{document}
结果:
