3

This is a neuro-fuzzy network picture. I do not know how to draw in LaTeX.

enter image description here

Thanks to your help, I have drawn the following picture. Than you very much. But, the picture has some minor faults: the size of circles is different; how to adjust the size of text;the picture is a little big;... enter image description here

\documentclass{article}
\usepackage{tikz}
\usepackage{float}
\usetikzlibrary{matrix}

\begin{document}


\begin{tikzpicture}[plain/.style={draw=none,fill=none},
                    net/.style={matrix of nodes,
                        nodes={draw,circle,minimum size=0.8cm},
                        nodes in empty cells,
                        column sep=1.9cm,
                        row sep=-6pt,
                      },
                    >=latex]

    \matrix[net] (mat) {
       |[plain]| \parbox{1.3cm}{\centering Input\\layer} &|[plain]| \parbox{1.3cm}{\centering E\\Function} &|[plain]| \parbox{1.3cm}{\centering H\\Function} &
|[plain]| \parbox{1.3cm}{\centering Output\\layer} \\
        |[plain]|   \\
        |[plain]|   &  {$A_{11}$} \\
        |[plain]|   \\
         {$x_1$} &   {$A_{12}$}&  {$h_{1}$}\\
          |[plain]|   &|[plain]| {\textbf{$\vdots$}}& |[plain]|  \\
          |[plain]|   &  {$A_{1n}$}&|[plain]| &|[plain]|   \\  
           |[plain]|   \\      
         |[plain]|  &  {$A_{21}$} &|[plain]| &|[plain]|\\
        |[plain]|   \\
         {$x_2$} &   {$A_{22}$}&  {$h_{2}$}&{z}\\
          |[plain]|   &|[plain]| {\textbf{$\vdots$}}& |[plain]|  \\
          |[plain]|   &  {$A_{2n}$} \\  
           |[plain]|   \\         
            |[plain]|   &  {$A_{m1}$} \\
        |[plain]|   \\
         {$x_m$} &   {$A_{m2}$}&  {$h_{n}$}\\
          |[plain]|   &|[plain]| {\textbf{$\vdots$}}& |[plain]|  \\
          |[plain]|   &  {$A_{mn}$} \\           
         };
        \foreach \xo in {5}{
        \foreach \aio in {3,5,7}
        \draw[->] (mat-\xo-1) -- (mat-\aio-2);}

 \foreach \xt in {11}{
        \foreach \ait in {9,11,13}
        \draw[->] (mat-\xt-1) -- (mat-\ait-2);}
\foreach \xh in {17}{
        \foreach \aih in {15,17,19}
        \draw[->] (mat-\xh-1) -- (mat-\aih-2);}

        \foreach \ai in {3,9,15}{
          \foreach \hi in {5}
        \draw[->] (mat-\ai-2) -- (mat-\hi-3);}
        \foreach \ai in {5,11,17}{
          \foreach \hi in {11}
        \draw[->] (mat-\ai-2) -- (mat-\hi-3);}
           \foreach \ai in {7,13,19}{
          \foreach \hi in {17}
        \draw[->] (mat-\ai-2) -- (mat-\hi-3);}
        \foreach \hi in {5,11,17}{
        \foreach \z in {11}
        \draw[->] (mat-\hi-3) -- (mat-\z-4);}

\end{tikzpicture}

\end{document}
5

2 Answers 2

2

Answer to initial question

One of the things you quickly learn on this site is that there is plenty of good information here which can be found quite easily with a little searching. The following questions should get you started. If you have trouble adapting them to your specific needs, then you can edit your question with a Minimal Working Example of the code you are using and people will be happy to help you then.

Answer to updated question

Here are some adjustments to the sample code you posted.

  • set the font in the nodes to \small
  • set the text width to 1.5em which will make all the nodes the same size
  • set the alignment in the nodes to center
  • reduced the row spacing a bit (changed to -.35cm)

The network you've drawn is quite big, so it's not that easy to make the diagram too much smaller.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}

\begin{document}


\begin{tikzpicture}[plain/.style={draw=none,fill=none},
                    net/.style={matrix of nodes,
                        nodes={draw,circle},
                        nodes in empty cells,
                        column sep=1.3cm,
                        row sep=-.35cm,
                        text width=1.5em,align=center, font=\small
                      },
                    >=latex,]

    \matrix[net] (mat) {
       |[plain]| {Input\\layer} &|[plain]|  {E\\Function} &|[plain]|  {H\\Function} &
|[plain]| {Output\\ layer} \\
        |[plain]|   \\
        |[plain]|   &  {$A_{11}$} \\
        |[plain]|   \\
            {$x_1$} &   {$A_{12}$}&  {$h_{1}$}\\
        |[plain]|   &|[plain]| {\textbf{$\vdots$}}& |[plain]|  \\
        |[plain]|   &  {$A_{1n}$}&|[plain]| &|[plain]|   \\  
        |[plain]|   \\      
        |[plain]|   &  {$A_{21}$} &|[plain]| &|[plain]|\\
        |[plain]|   \\
           {$x_2$}  &   {$A_{22}$}&  {$h_{2}$}&{z}\\
        |[plain]|   &|[plain]| {\textbf{$\vdots$}}& |[plain]|  \\
        |[plain]|   &  {$A_{2n}$} \\  
        |[plain]|   \\         
        |[plain]|   &  {$A_{m1}$} \\
        |[plain]|   \\
            {$x_m$} &   {$A_{m2}$}&  {$h_{n}$}\\
        |[plain]|   &|[plain]| {\textbf{$\vdots$}}& |[plain]|  \\
        |[plain]|   &  {$A_{mn}$} \\           
         };
        \foreach \xo in {5}{
            \foreach \aio in {3,5,7}
        \draw[->] (mat-\xo-1) -- (mat-\aio-2);}
        \foreach \xt in {11}{
            \foreach \ait in {9,11,13}
        \draw[->] (mat-\xt-1) -- (mat-\ait-2);}
        \foreach \xh in {17}{
            \foreach \aih in {15,17,19}
        \draw[->] (mat-\xh-1) -- (mat-\aih-2);}
        \foreach \ai in {3,9,15}{
            \foreach \hi in {5}
        \draw[->] (mat-\ai-2) -- (mat-\hi-3);}
        \foreach \ai in {5,11,17}{
            \foreach \hi in {11}
        \draw[->] (mat-\ai-2) -- (mat-\hi-3);}
        \foreach \ai in {7,13,19}{
            \foreach \hi in {17}
        \draw[->] (mat-\ai-2) -- (mat-\hi-3);}
        \foreach \hi in {5,11,17}{
            \foreach \z in {11}
        \draw[->] (mat-\hi-3) -- (mat-\z-4);}
\end{tikzpicture}
\end{document}

output of code

1

Alan Munn provides useful links and there are packages that address this issue, but here's some simple tikz code to get you started.

\documentclass[12t,crop]{standalone}

\usepackage{tikz}

\begin{document}

\begin{tikzpicture}
\foreach \x in {0,1,2} \node[circle,draw] (L\x) at (0,2*\x) {$x_\x$};
\foreach \x in {0,1,2} \node[circle,draw] (R\x) at (2,2*\x+1) {$y_\x$};
\draw[->] (L0)--(R1);
\end{tikzpicture}
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .