Cos ( double angle);

Default values:


Returns the trigonometric cosine of an angle.

Input parameters

Parameter Default value Description
angle - Defines angle (in radians) whose cosine is calculated.


declare lower;
input a = 0;
input b = 10;
input periodBars = 20;
def w = 2 * Double.Pi / periodBars;
def x = CompoundValue(1, x[1] + 1, 0);
plot F = a + b * Cos(w * x);

The code draws the cosine function depending on a variable which starts from one and increments by one on each bar. The cyclic frequency(w) is calculated based on the periodBars input.