Hyperbolic tangent
Y = tanh(X)
example
Y = tanh(X) returns the hyperbolic tangent of the elements of X. The tanh function operates element-wise on arrays. The function accepts both real and complex inputs. All angles are in radians.
X
tanh
collapse all
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 -5≤x≤5.
x = -5:0.01:5; y = tanh(x); plot(x,y) grid on
Input angles in radians, specified as a scalar, vector, matrix, or multidimensional array.
Data Types: single | double Complex Number Support: Yes
single
double
The hyperbolic tangent of an angle x is the ratio of the hyperbolic sine and hyperbolic cosine
tanh(x)=sinh(x)cosh(x)=e2x−1e2x+1.
In terms of the traditional tangent function with a complex argument, the identity is
tanh(x)=−itan(ix) .
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).
atan | atan2 | atanh | cosh | sinh | tan
atan
atan2
atanh
cosh
sinh
tan
You have a modified version of this example. Do you want to open this example with your edits?