3.5.4.1 fftamp

Description

Calculate amplitude from FFT complex result.

Syntax

vector fftamp(vector<complex> cx, int side = 1)


Parameters

cx

The FFT complex results

side

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

Return

Return the amplitude.


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 four new columns to store the amplitude results
// Column C would be one-sided result
// Column D would be two-sided result
// Column E would be one sided result with DC offset removed
worksheet -a 3;

// Set column labels to distinguish
col(C)[L]$ = "Amplitude";
col(C)[C]$ = "One-Sided";

col(D)[L]$ = "Amplitude";
col(D)[C]$ = "Two-Sided";

col(E)[L]$ = "Amplitude";
col(E)[C]$ = "DC Offset Removal";

// First use fftc to get FFT complex result
// Then use fftamp to get amplitude in column C and D
col(C) = fftamp(fftc(rSignal));// One-Sided
col(D) = fftamp(fftc(rSignal), 2);// Two-Sided and shift
col(E) = fftamp(fftc(rSignal - mean(rSignal)));//DC Offset Removal

See Also

fftmag, fftc, fftphase, windata