fftmag-func
Calculate magnitude from FFT complex result.
vector fftmag(vector<complex> cx, int side = 1)
cx
side
Return magnitude.
// Start with a new workbook newbook; // 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]$ = "Magnitude"; col(C)[C]$ = "One-Sided"; col(D)[L]$ = "Magnitude"; col(D)[C]$ = "Two-Sided"; // First use fftc to get FFT complex result // Then use fftmag to get magnitude in column C and D col(C) = fftmag(fftc(rSignal));// One-Sided col(D) = fftmag(fftc(rSignal), 2);// Two-Sided and shift
fftamp, fftc, windata