Previous: Cheese and Lettuce on Toast  Up: Step-by-Step Examples  Next: Bus

# An Artificial Neuron

This example illustrates setting line styles and adding text. The final image looks best as a pgf picture included in a LaTeX document, as then you can use maths fonts with subscripts.

1. Select the rectangle tool, and create a rectangle, as shown in Figure 11.16.

Select the ellipse tool, and create a circle, as shown in Figure 11.17.

2. To make the logistic function symbol, select the open curve tool, and do a single segment (Figure 11.18(a)). Then use the edit path tool to adjust the curvature, as shown in Figure 11.18(b). (If you have enabled the grid lock, you may find it easier to disable it while you are editing the curvature control points.)

 (a) (b)
Figure 11.18: Artificial Neuron Example--creating a sigmoidal curve: (a) adding an open curve segment; (b) edit segment to adjust curvature.

3. Next set the current line style to have an end arrow. Note that lines with end markers look best with a butt cap style, so this should also be set. This can be done as follows:

Use the Settings->Styles... menu item to display the current styles dialog box. Select the tab labelled Line Style to display the line style panel. Select Butt from the drop-down list labelled Cap Style (see Figure 11.19). Next select the button labelled Select... located on the same row as End Marker to open the end marker dialog box (illustrated in Figure 11.20). Select the radio button labelled Use Marker. This will enable the marker chooser panel. Select the tab labelled Arrows and select Pointed 60. Select Okay to close the end marker dialog box and select Okay to close the styles dialog box.

4. Select the open line tool, and add in the arrows as illustrated in Figure 11.21.

Use Settings->Styles... to open the current styles selector, and set the font family to "Serif" and press Okay. Select the text tool, and add in the text, as illustrated in Figure 11.22.

If you want to include your image into a LaTeX document as a pgfpicture environment, it would look better if you put the text into maths mode, and use subscripts. To do this first select the text area, and then select Edit->Text->Edit text.... This will open up the edit text dialog box. Click on the Different button, and enter the text as it should be in the LaTeX file (Figure 11.23.) Do this for each text area. In addition, select all of the text on the left ("x1", "x2" and "xn") and use the Edit->Text->Font Style->All Styles... dialog box to change the horizontal anchor parameter to Right. (Note that you will not see any difference to the image in Jpgfdraw.)

5. Select the text tool and start a text area in the rectangle. I want to use a capital sigma to indicate a summation, and as I don't know the magic combination of characters to access that symbol, I used the Insert Symbol dialog box. To do this, either use the popup menu and select Insert Symbol..., or press the Ins key. The required symbol can now be selected from the dialog box (illustrated in Figure 11.24).

6. Use the Edit->Text->Font Style->All Styles... to change the font size to 25 and change both the anchor settings to Centre, see Figure 11.25. (You don't need to change the anchor settings if you have the automatic anchor update setting enabled, as it will change when you justify the text area in step 9.)

If you want to export your image into a LaTeX document, you will need to set the LaTeX equivalent text to $\Sigma$. As before, this is done by selecting the text area and using the Edit->Text->Edit text... menu item to open the Edit Text dialog box (Figure 11.26(b)).

 (a) (b)
Figure 11.26: Artificial Neuron Example--setting the equivalent LaTeX symbol: (a) selected text; (b) setting LaTeX equivalent.

7. The Sigma would look much better if it was centred inside the rectangle. To do this select the Sigma and the rectangle, then group them either by clicking on the group objects button or by using the Transform->Group menu item. Then select the Transform->Justify->Centre menu item, and then the Transform->Justify->Middle menu item. The text area should now be centred inside the rectangle (Figure 11.27).

To include the image inside a LaTeX document, save the image to a LaTeX file using the File->Export... menu item, and then include it in your document (assuming the file was called neuron.tex):

\begin{figure}
\centering
\input{neuron}
\caption{An Artificial Neuron}
\end{figure}

(Remember to use the pgf package.) The image will appear in the LaTeX document as illustrated in Figure 11.28. (For best results use either PDFLaTeX or LaTeX and dvips as some dvi viewers may not be able to interpret the pgf specials.)

Previous: Cheese and Lettuce on Toast  Up: Step-by-Step Examples  Next: Bus
© 2012 Dickimaw Books. "Dickimaw", "Dickimaw Books" and the Dickimaw parrot logo are trademarks. The logo was derived from a painting by Magdalene Pritchett.