Neural Network Toolbox Previous page   Next Page

Simulation (sim)

To show how sim works we examine a simple problem.

Suppose we take a perceptron with a single two-element input vector, like that discussed in the decision boundary figure. We define the network with

As noted above, this gives us zero weights and biases, so if we want a particular set other than zeros, we have to create them. We can set the two weights and the one bias to -1, 1 and 1 as they were in the decision boundary figure with the following two lines of code.

To make sure that these parameters were set correctly, we check them with

Now let us see if the network responds to two signals, one on each side of the perceptron boundary.

and for

Sure enough, the perceptron classified the two inputs correctly.

Note that we could present the two inputs in a sequence and get the outputs in a sequence as well.

You may want to read more about sim in Advanced Topics.


Previous page  Creating a Perceptron (newp) Initialization (init) Next page

© 1994-2005 The MathWorks, Inc.