DADiSP Worksheet Functions > Function Categories > Trigonometric Series Generation > GCOS

 

GCOS

Purpose:

Generates a cosine series in accordance with the specified parameters.

Syntax:

GCOS(length, spacing, frequency, phase)

length

-

An integer, the length of the output series.

spacing

-

A real, the spacing (delta x) between each point on the x-axis.

frequency

-

Optional. A real, the frequency specified in cycles per second (Hertz). Defaults to 1.

phase

-

Optional. A real, the phase specified in radians. Defaults to 0.

Returns:

A series.

Example:

gcos(100, 0.1, 2, 5)

 

creates a cosine wave of 100 points spaced 0.1 x-units apart resulting in 20 cycles in the series. This series will also be shifted by five units (the offset value) on the x-axis, and compressed by a factor of 2.

Example:

gcos(1000, 1/1000, 200)

 

generates 1000 samples of a 200 Hz cosine sampled at 1000 samples/sec.

Remarks:

The formula used to generate each point, n, in the series is as follows:

 

y[n] = COS(2π • frequency • spacing • (n-1) + phase)

See Also:

COS

TRIGNOMETRIC FUNCTION GENERATORS