GHAVERSIN

Purpose:

Generates a haversin series in accordance with the specified parameters.

Syntax:

GHAVERSIN(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:

W1: ghaversin(1000, 1/1000)

 

Generates 1000 samples of a 1 Hz haversin sampled at 1000 Hz.

Example:

W2: ghaversin(1000, 1/1000, 2.0, pi/3)

 

Same as above except the frequency is 2 Hz and the phase is π/3 radians.

Remarks:

The haversin function is defined as:

 

 

The formula used to generate y[n] for n = 1 to N is:

 

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

See Also:

GHALFSIN

GSIN

HAVERSIN

SIN

TRIGNOMETRIC FUNCTION GENERATORS

References:

[1]

C. C. Robusto

 

The Cosine-Haversine Formula

 

The American Mathematical Monthly, 64(1), 1957

 

pp 38-40