| Products & Services | Industries | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → MATLAB |
| Contents | Index |
| Learn more about MATLAB |
Y = cos(X)
Y = cos(X) returns the cosine for each element of X. The cos function operates element-wise on arrays. All angles are in radians.
The cosine of an angle is:
![]()
For complex values, cosine is:
![]()
Graph the cosine function over the domain
:
x = -pi:0.01:pi; plot(x,cos(x)), grid on

cos uses FDLIBM, which was developed at SunSoft, a Sun Microsystems business, by Kwok C. Ng, and others. For information about FDLIBM, see http://www.netlib.org.
![]() | corrcoef | cosd | ![]() |

Includes the most popular MATLAB recorded presentations with Q&A sessions led by MATLAB experts.
| © 1984-2009- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |