MATLAB Function Reference |
Syntax
Y = sec(X) Y = sech(X)
Description
The sec
and sech
commands operate element-wise on arrays. The functions' domains and ranges include complex values. All angles are in radians.
Y = sec(X)
returns an array the same size as X
containing the secant of the elements of X
.
Y = sech(X)
returns an array the same size as X
containing the hyperbolic secant of the elements of X
.
Examples
Graph the secant over the domains and and the hyperbolic secant over the domain
x1 = -pi/2+0.01:0.01:pi/2-0.01; x2 = pi/2+0.01:0.01:(3*pi/2)-0.01; plot(x1,sec(x1),x2,sec(x2)) x = -2*pi:0.01:2*pi; plot(x,sech(x))
The expression sec(pi/2)
does not evaluate as infinite but as the reciprocal of the floating-point accuracy eps
, because pi
is a floating-point approximation to the exact value of .
Algorithm
See Also
asec
, asech
Inverse secant and inverse hyperbolic secant
script | selectmoveresize |