Neural Network Toolbox Previous page   Next Page
sim

Simulate a neural network

Syntax

[Y,Pf,Af,E,perf] = sim(net,P,Pi,Ai,T)

[Y,Pf,Af,E,perf] = sim(net,{Q TS},Pi,Ai,T)

[Y,Pf,Af,E,perf] = sim(net,Q,Pi,Ai,T)

To Get Help

Type help network/sim

Description

sim simulates neural networks.

[Y,Pf,Af,E,perf] = sim(net,P,PiAi,T) takes,

and returns,

Note that arguments Pi, Ai, Pf, and Af are optional and need only be used for networks that have input or layer delays.

    sim's signal arguments can have two formats: cell array or matrix.

The cell array format is easiest to describe. It is most convenient for networks with multiple inputs and outputs, and allows sequences of inputs to be presented:

where

The columns of Pi, Ai, Pf, and Af are ordered from oldest delay condition to most recent:

The matrix format can be used if only one time step is to be simulated
(TS = 1). It is convenient for networks with only one input and output, but can also be used with networks that have more.

Each matrix argument is found by storing the elements of the corresponding cell array argument into a single matrix:

[Y,Pf,Af] = sim(net,{Q TS},Pi,Ai) is used for networks which do not have an input, such as Hopfield networks, when cell array notation is used.

Examples

Here newp is used to create a perceptron layer with a two-element input (with ranges of [0 1]), and a single neuron.

Here the perceptron is simulated for an individual vector, a batch of three vectors, and a sequence of three vectors.

Here newlind is used to create a linear layer with a three-element input, two neurons.

Here the linear layer is simulated with a sequence of two input vectors using the default initial input delay conditions (all zeros).

Here the layer is simulated for three more vectors using the previous final input delay conditions as the new initial delay conditions.

Here newelm is used to create an Elman network with a one-element input, and a layer 1 with three tansig neurons followed by a layer 2 with two purelin neurons. Because it is an Elman network it has a tap delay line with a delay of 1 going from layer 1 to layer 1.

Here the Elman network is simulated for a sequence of three values using default initial delay conditions.

Here the network is simulated for four more values, using the previous final delay conditions as the new initial delay conditions.

Algorithm

sim uses these properties to simulate a network net.

These properties determine the network's weight and bias values, and the number of delays associated with each weight:

These function properties indicate how sim applies weight and bias values to inputs to get each layer's output:

See Neuron Model and Network Architectures for more information on network simulation.

See Also

init, adapt, train, revert


Previous page  setx softmax Next page

© 1994-2005 The MathWorks, Inc.