Help CenterHelp Center
Cosine of argument in radians
Y = cos(X)
Y= cos(X)returns the cosine for each element ofX. Thecosfunction operates element-wise on arrays. The function accepts both real and complex inputs.
Y= cos(X)
Y
X
cos
For real values ofX,cos(X)returns real values in the interval [-1, 1].
cos(X)
For complex values ofX,cos(X)returns complex values.
collapse all
Plot the cosine function over the domain - π ≤ x ≤ π .
x = -pi:0.01:pi; plot(x,cos(x)) gridon
Calculate the cosine of the complex angles in vectorx.
x
x = [-i pi+i*pi/2 -1+i*4]; y = cos(x)
y =1×3 complex1.5431 + 0.0000i -2.5092 - 0.0000i 14.7547 +22.9637i
Input angle in radians, specified as a scalar, vector, matrix, or multidimensional array.
Data Types:single|doubleComplex Number Support:Yes
single
double
Cosine of input angle, returned as a real-valued or complex-valued scalar, vector, matrix or multidimensional array.
The cosine of an angle, α, defined with reference to a right angled triangle is
cos ( α ) = adjacent side hypotenuse = b h .
The cosine of a complex argument, α, is
cos ( α ) = e i α + e − i α 2 .
This function fully supports tall arrays. For more information, seeTall Arrays.
backgroundPool
ThreadPool
This function fully supports thread-based environments. For more information, seeRun MATLAB Functions in Thread-Based Environment.
This function fully supports GPU arrays. For more information, seeRun MATLAB Functions on a GPU(Parallel Computing Toolbox).
This function fully supports distributed arrays. For more information, seeRun MATLAB Functions with Distributed Arrays(Parallel Computing Toolbox).
cosd|acos|acosd|cosh|cospi
cosd
acos
acosd
cosh
cospi
You have a modified version of this example. Do you want to open this example with your edits?
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office