Main Content

cosd

Cosine of argument in degrees

Description

Y = cosd(X) returns the cosine of the elements of X, which are expressed in degrees.

example

Examples

collapse all

cosd(90)
ans = 
0
cos(pi/2)
ans = 
6.1232e-17

Create an array of three complex angles and compute the cosine.

z = [180+i 45+2i 10+3i];
y = cosd(z)
y = 1×3 complex

  -1.0002 + 0.0000i   0.7075 - 0.0247i   0.9862 - 0.0091i

Input Arguments

collapse all

Angle in degrees, specified as a real-valued or complex-valued scalar, vector, matrix, multidimensional array, table, or timetable. The cosd operation is element-wise when X is nonscalar.

Data Types: single | double | table | timetable
Complex Number Support: Yes

Output Arguments

collapse all

Cosine of angle, returned as a real-valued or complex-valued scalar, vector, matrix, multidimensional array, table, or timetable of the same size as X.

Extended Capabilities

C/C++ Code Generation
Generate C and C++ code using MATLAB® Coder™.

Version History

Introduced before R2006a

expand all

See Also

| |