我正在尝试在我的 LyX 文档中绘制以下简单的径向基函数图:
因此,我需要帮助来编写 LaTeX 代码,但我希望输出图像如下所示:
我在 Lyx 的 ERT 框中尝试了此代码,它给了我图 2...但我不知道如何在隐藏层的圆圈节点内包含特殊符号。
\begin{figure}[htp]
\centering
\begin{tikzpicture}[
plain/.style={
draw=none,
fill=none,
},
net/.style={
matrix of nodes,
nodes={
draw,
circle,
inner sep=8.5pt
},
nodes in empty cells,
column sep=0.6cm,
row sep=-11pt
},
>=latex
]
\matrix[net] (mat)
{
|[plain]| \parbox{1cm}{\centering Input\\layer} & |[plain]| \parbox{1cm}{\centering Hidden\\layer} & |[plain]| \parbox{1cm}{\centering Output\\layer} \\
& |[plain]| \\
|[plain]| & \\
& |[plain]| \\
|[plain]| & |[plain]| \\
& & \\
|[plain]| & |[plain]| \\
& |[plain]| \\
|[plain]| & \\
& |[plain]| \\
};
\foreach \ai [count=\mi ]in {2,4,...,10}
\draw[<-] (mat-\ai-1) -- node[above] {I\mi} +(-1cm,0);
\foreach \ai in {2,4,...,10}
{\foreach \aii in {3,6,9}
\draw[->] (mat-\ai-1) -- (mat-\aii-2);
}
\foreach \ai in {3,6,9}
\draw[->] (mat-\ai-2) -- (mat-6-3);
\draw[->] (mat-6-3) -- node[above] {O1} +(1cm,0);
\end{tikzpicture}
\end{figure}
答案1
就这样吗?
代码
\documentclass[12pt]{article}
\usepackage[paper size={15cm,15cm}]{geometry}
\usepackage{tikz}
\usetikzlibrary{shapes,positioning,matrix}
\begin{document}
\begin{figure}[htp]
\centering
\begin{tikzpicture}[
plain/.style={
draw=none,
fill=none,
},
net/.style={
matrix of nodes,
nodes={
draw,
circle,
inner sep=8.5pt
},
nodes in empty cells,
column sep=0.6cm,
row sep=-11pt
},
>=latex
]
\matrix[net] (mat)
{
|[plain]| \parbox{1cm}{\centering Input\\layer} &
|[plain]| \parbox{1cm}{\centering Hidden\\layer} &
|[plain]| \parbox{1cm}{\centering Output\\layer} \\
& |[plain]| \\
|[plain]| & \\
& |[plain]| \\
|[plain]| & |[plain]| $\vdots$\\
|[plain]|$\vdots$& & \\
|[plain]| & |[plain]|$\vdots$ \\
& |[plain]| \\
|[plain]| & \\
& |[plain]| \\
};
\foreach \ai [count=\mi ]in {2,4}
\draw[<-] (mat-\ai-1) -- node[above] {$x_\mi$} +(-1cm,0);
\draw[<-] (mat-8-1) -- node[above] {$x_{p-1}$} +(-1cm,0);
\draw[<-] (mat-10-1) -- node[above] {$x_{p}$} +(-1cm,0);
\foreach \ai in {2,4,8,10}
{\foreach \aii in {3,6,9}
\draw[->] (mat-\ai-1) -- (mat-\aii-2)node(){$\varphi$};
}
\draw[->] (mat-3-2) --node[above]{$w_1$} (mat-6-3);
\draw[->] (mat-6-2) --node[above]{$w_j$} (mat-6-3);
\draw[->] (mat-9-2) --node[above]{$w_N$} (mat-6-3);
\draw[->] (mat-6-3) -- node[above] {$F(x)$} +(2cm,0);
\end{tikzpicture}
\end{figure}
\end{document}