cos
|
Page in progress. |
The cosine of the argument is in radians.
| Library |
|
Arguments
Input arguments
# X is the value of the input angle in rad
+
scalar | vector | matrix | N-dimensional array
Details
The value of the input angle in rad, specified as a scalar, vector, matrix, or multidimensional array.
| Data types |
|
| Support for complex numbers |
Yes |
Output arguments
# Y is the cosine value of the input angle
+
scalar | vector | matrix | N-dimensional array
Details
The cosine value of the input angle returned as a real or complex scalar, vector, matrix, or multidimensional array.
| Data types |
|
| Support for complex numbers |
Yes |
Examples
Graph of the cosine function
Details
Let’s plot the cosine function for .
import EngeeDSP.Functions: cos
using Plots
x = -pi:0.01:pi
plot(x, cos.(x), grid = true)
xlabel!("x")
ylabel!("cos(x)")

Cosine of the vector of complex angles
Details
Calculate the cosine of the complex angles of the vector .
import EngeeDSP.Functions: cos
x = [-im, pi + im*pi/2, -1 + im*4]
y = cos.(x)
3-element Vector{ComplexF64}:
1.5430806348152437 + 0.0im
-2.5091784786580567 - 2.818278334591946e-16im
14.754701170483758 + 22.96367349919304im