我最近才开始学习 LaTeX 写报告。所以我不熟悉大多数 LaTeX 命令和环境。有人能帮我吗?我正在尝试用 LaTeX 绘制以下模型。
编辑:在 N3buchadnezzar 的帮助下,我尝试根据需要进行一些更改,但现在的问题是箭头和标签之间的间距。最好的结果如图所示,我想让它尽可能接近第一张图片。救命!
\documentclass{article}
\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=10pt
},
nodes in empty cells,
column sep=0.6cm,
row sep=-11pt
},
>=latex
]
\matrix[net,row sep=0em, column sep=4em] (mat)
{
|[plain]|& |[plain]| \parbox{1cm}{\centering $C_j , \sigma_j$} &|[plain]|\\
& \\
|[plain]| & |[plain]| & & & \\
& & |[plain]|$\vdots$ \\
|[plain]|$\vdots$ & |[plain]|$\vdots$ & & & \\
& \\
|[plain]| \parbox{1cm}{\centering I}& |[plain]| \parbox{1cm}{\centering J} &|[plain]| \parbox{1cm}{\centering K}\\
};
\foreach \ai in {2,4,6}
{\foreach \aii in {2,4,6}
\draw[->] (mat-\ai-1) -- (mat-\aii-2);
}
\draw[->] (mat-2-2) --node[above]{$w_{11}$} (mat-3-3)node(){$\sum$};
\draw[->] (mat-2-2) --node[above]{$w_{21}$} (mat-5-3)node(){$\sum$};
\draw[->] (mat-4-2) --node[below]{$w_{12}$} (mat-3-3);
\draw[->] (mat-4-2) --node[below]{$w_{22}$} (mat-5-3);
\draw[->] (mat-6-2) --node[above]{$w_{1j}$} (mat-3-3);
\draw[->] (mat-6-2) --node[below]{$w_{kj}$} (mat-5-3);
\draw[->] (mat-3-3) --node[above]{$y_1$} (mat-3-4);
\draw[->] (mat-3-5)node(){$t_i$} -- (mat-3-4);
\draw[->] (mat-5-3) --node[above]{$y_k$} (mat-5-4);
\draw[->] (mat-5-5)node(){$t_k$} -- (mat-5-4);
\node(x1) at (mat-2-1){$x_1$};
\node(s1) at (mat-2-2)[label=below:$(C_{11}...C_{1i})$]{$\sigma_1$};
\node(x1) at (mat-4-1){$x_2$};
\node(s2) at (mat-4-2)[label=below:$(C_{21}...C_{2i})$]{$\sigma_2$};
\node(x1) at (mat-6-1){$x_i$};
\node(s3) at (mat-6-2)[label=below:$(C_{j1}...C_{ji})$]{$\sigma_3$};
\end{tikzpicture}
\end{figure}
\end{document}
答案1
这是一个起点。看看你自己能走多远。我只是用了以下想法在 LyX 中绘制径向基函数图。
代码
\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,row sep=0em, column sep=3em] (mat)
{
& \\
|[plain]| & |[plain]| & & & \\
& \\
|[plain]|$\vdots$ & |[plain]|$\vdots$ & & & \\
& \\
};
\foreach \ai in {1,3,5}
{\foreach \aii in {1,3,5}
\draw[->] (mat-\ai-1) -- (mat-\aii-2);
}
\foreach \ai in {1,3,5}
{\foreach \aii in {2,4}
\draw[->] (mat-\ai-2) -- (mat-\aii-3)node(){$\sum$};
}
\draw[->] (mat-2-3) -- (mat-2-4); \draw[->] (mat-2-5)node(){$t_i$} -- (mat-2-4);
\draw[->] (mat-4-3) -- (mat-4-4); \draw[->] (mat-4-5)node(){$t_k$} -- (mat-4-4);
\node(x1) at (mat-1-1){$x_1$}; \node(s1) at (mat-1-2){$\sigma_1$};
\node(x1) at (mat-3-1){$x_2$}; \node(s2) at (mat-3-2){$\sigma_2$};
\node(x1) at (mat-5-1){$x_i$}; \node(s3) at (mat-5-2){$\sigma_3$};
\end{tikzpicture}
\end{figure}
\end{document}