Y = tanh(X)
Create a vector and calculate the hyperbolic tangent of each value.
X = [0 pi 2*pi 3*pi]; Y = tanh(X)
Y = 1×4 0 0.9963 1.0000 1.0000
Plot the hyperbolic tangent function over the domain .
x = -5:0.01:5; y = tanh(x); plot(x,y) grid on
X— Input angles in radians
Input angles in radians, specified as a scalar, vector, matrix, or multidimensional array.
Complex Number Support: Yes
The hyperbolic tangent of an angle x is the ratio of the hyperbolic sine and hyperbolic cosine
In terms of the traditional tangent function with a complex argument, the identity is
This function fully supports tall arrays. For more information, see Tall Arrays.
This function fully supports GPU arrays. For more information, see Run MATLAB Functions on a GPU (Parallel Computing Toolbox).
This function fully supports distributed arrays. For more information, see Run MATLAB Functions with Distributed Arrays (Parallel Computing Toolbox).