ADDPHASE

Purpose:

Adds a constant phase value to a series.

Syntax:

ADDPHASE(series, p)

series

-

A series or array.

p

-

A real, the phase value in radians.

Returns:

A series or array.

Example:

W1: gsin(1000, 1/1000, 3)

W2: gcos(1000, 1/1000, 3)

W3: addphase(w1, pi/2)

W4: w2-w3

 

W1 contains a 3 Hz sine wave with a sample rate of 1000 Hz.

W2 contains a 3 Hz cosine wave with a sample rate of 1000 Hz.

W3 adds π/2 radians of phase shift to the sine wave.

W4 displays the difference between the cosine and the phase shifted sine.

Example:

W1: 1..10

W2: -w1

W3: addphase(w1, pi)

W4: w2-w3

 

W1 contains a linear ramp.

W2 inverts the ramp.

W3 adds π radians of phase shift to the sine wave.

W4 displays the difference between the inverted ramp and  the phase shifted ramp.

Example:

W1: gcos(1000, 1/1000, 3)

W2: gcos(1000, 1/1000, 9)

W3: w1 + w2

W4: addphase(w3, pi/4)

W5: addphase(w1, pi/4) + addphase(w2, pi/4)

W6: w4 - w5

 

W1 and W2 each contain a cosine wave.

W3 sums the cosines.

W4 adds π/4 radians of phase shift to the sum.

W5 adds π/4 radians of phase shift to each component and  then sums.

W6 shows the results are identical to machine precision.

Remarks:

ADDPHASE adds a phase constant to the PHASE of the FFT of the input series. The result is transformed back to the time domain.

 

If the series is purely real, the phase input value is converted to an anti-symmetric constant series and added to the original phase. The original DC phase value is preserved or set to π if the phase input is an odd multiple of π.  If the series is real and even length, the original Nyquist phase value is also preserved or set to -π if the phase input is an odd multiple of phase. This handling of DC and Nyquist phase inverts the input series for a phase input of +- for N odd.

See Also:

FFT

MAGNITUDE

PHASE

PHASEDIFF