Neural Network Toolbox | Search  Help Desk |
tansig | Examples See Also |
Hyperbolic tangent sigmoid transfer function
A = tansig(N) info = tansig(code)tansig is a transfer function. Transfer functions calculate a layer's output from its net input. tansig
(N)
takes one input,
N - S
x Q
matrix of net input (column) vectors.
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.
Here is the code to create a plot of the tansig transfer function.
n = -5:0.1:5; a = tansig(n); plot(n,a)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.
tansig(N)
calculates its output according to:
n = 2/(1+exp(-2*n))-1This 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.
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.sim
,
dtansig
,
logsig