fftphase

Contents

Description

Calculate phase from FFT complex result.

Syntax

vector fftphase(vector<complex> cx, int side = 1, int unwrap = 1, int unit = 1)

Parameters

cx

The FFT complex results

side

Define the output spectrum, 1 = one-sided (default), 2 = two-sided and shift.

unwrap

Define whether to unwrap phase angle, 0 = not to unwrap, 1 = unwrap (default).

unit

Define the unit, 0 = radians, 1 = degrees (default).


Return

Return the phase

Example

// Import the signal data
string fname$ = system.path.program$ + "Samples\Signal Processing\fftfilter1.DAT";
impASC fname:=fname$;
 
// Define a range variable for input signal
range rSignal = col(2);
 
// Add two new columns to store the amplitude results (one-sided, two-sided)
worksheet -a 2;
 
// Set column labels to distinguish
col(C)[L]$ = "Phase";
col(C)[C]$ = "One-Sided";
 
col(D)[L]$ = "Phase";
col(D)[C]$ = "Two-Sided";
 
// First use fftc to get FFT complex result
// Then use fftphase to get magnitude in column C and D
col(C) = fftphase(fftc(rSignal));// One-Sided
col(D) = fftphase(fftc(rSignal), 2, 0, 0);// Two-Sided, not unwrapped and with radian unit

See Also

fftamp