cosd

Cosine of an angle given in degrees.

Category: Mathematics > Elementary Math

Syntax

Y = cosd(X)

Returns the cosine of each element of X, in degrees.

Description

cosd(X) is the cosine of X degrees. Unlike cos(X*pi/180), it returns exact values at multiples of 90 degrees: cosd(90) is exactly 0 and cosd(60) is 0.5.

Input arguments

X
Numeric array of any size.

Output arguments

Y
Array of the same size as X.

Example

Exact cosine in degrees

cosd([0 60 90 180])
cos(90*pi/180)
Output
ans = 1×4

    1.0000    0.5000         0   -1.0000
ans = 6.1232e-17

See also

cos sind acosd deg2rad