cos, cosh

Purpose

Cosine and hyperbolic cosine.

Synopsis

Y = cos(X)
Y = cosh(X)

Description

The trigonometric functions operate element-wise on matrices. Their domains and ranges include complex values. All angles are measured in radians.

cos(X) is the circular cosine for each element of X.

cosh(X) is the hyperbolic cosine for each element of X.

Examples

M = magic(3)
          
M =
    8    1    6
    3    5    7
    4    9    2
          
cos(M*pi/4) =
    1.0000      0.7071     -0.0000
   -0.7071     -0.7071      0.7071
   -1.0000      0.7071      0.0000
cos(pi/2) is not exactly zero, but rather a value the size of the floating-point accuracy, eps, because pi is not exactly equal to pi .

Algorithm

See Also

acos, asin, atan, exp, expm, funm, sin, tan

(c) Copyright 1994 by The MathWorks, Inc.