cos

Purpose

Returns the cosine of its argument.

Format

y = cos(x)
Parameters:

x (NxK matrix) – data, for real matrices should contain angles measured in radians. To convert degrees to radians, multiply the degrees by \(π/180\).

Returns:

y (NxK matrix) – containing the cosines of the elements of x.

Examples

// Create a sequence starting at 0 and increasing by pi/4
x = seqa(0, pi/4, 5);
y = cos(x);
    0.0000      1.0000
    0.7854      0.7071
x = 1.5708  y = 0.0000
    2.3562     -0.7071
    3.1416     -1.0000

See also

Functions atan(), atan2(), pi()