Neural Network Toolbox Previous page   Next Page
tansig

Hyperbolic tangent sigmoid transfer function

Graph and Symbol

Syntax

Description

tansig is a transfer function. Transfer functions calculate a layer's output from its net input.

tansig(N) takes one input,

and returns each element of N squashed between -1 and 1.

tansig(code) return useful information for each code string:

tansig is named after the hyperbolic tangent, which has the same shape. However, tanh may be more accurate and is recommended for applications that require the hyperbolic tangent.

Examples

Here is the code to create a plot of the tansig transfer function.

Network Use

You can create a standard network that uses tansig by calling newff or newcf.

To change a network so a layer uses tansig, set net.layers{i,j}.transferFcn to 'tansig'.

In either case, call sim to simulate the network with tansig. See newff or newcf for simulation examples.

Algorithm

tansig(N) calculates its output according to:

This is mathematically equivalent to tanh(N). It differs in that it runs faster than the MATLAB® implementation of tanh, but the results can have very small numerical differences. This function is a good trade off for neural networks, where speed is important and the exact shape of the transfer function is not.

See Also

References

Vogl, T. P., J.K. Mangis, A.K. Rigler, W.T. Zink, and D.L. Alkon, "Accelerating the convergence of the backpropagation method," Biological Cybernetics, vol. 59, pp. 257-263, 1988.


Previous page  sumsqr train Next page

© 1994-2005 The MathWorks, Inc.