Neural Network Toolbox
  Go to function:
    Search    Help Desk 
sim    Examples   See Also

Simulate a neural network

Syntax

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

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

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

To Get Help

Type help network/sim

Description

sim simulates neural networks.

[Y,Pf,Af] = sim(net,P,Pi,Ai) 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.

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

Examples

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

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

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

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

Here the layer is simulated for 3 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 1-element input, and a layer 1 with 3 tansig neurons followed by a layer 2 with 2 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 3 values using default initial delay conditions.

Here the network is simulated for 4 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 Chapter 2 for more information on network simulation.

See Also

init, adapt, train



[ Previous | Help Desk | Next ]