MATLAB Function Reference | Search  Help Desk |
tan, tanh | Examples See Also |
Tangent and hyperbolic tangent
Y = tan(X) Y = tanh(X)The
tan
and tanh
functions operate element-wise on arrays. The functions' domains and ranges include complex values. All angles are in radians.
Y = tan(X)
returns the circular tangent of each element of X
.
Y = tanh(X)
returns the hyperbolic tangent of each element of X
.
Graph the tangent function over the domain and the hyperbolic tangent function over the domain
x = (-pi/2)+0.01:0.01:(pi/2)-0.01; plot(x,tan(x)) x = -5:0.01:5; plot(x,tanh(x))The expression
tan(pi/2)
does not evaluate as infinite but as the reciprocal of the floating point accuracy eps
since pi
is only a floating-point approximation to the exact value of .
atan
, atan2