Latex 绘制异或问题的网络结构

代码:

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

结果:

这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值