FFT in Igor Pro
The transform gives a complex wave whose x axis is frequency.
Function/WAVE Spectrum(WAVE signal)
Variable n = numpnts(signal)
if (mod(n, 2) != 0)
Redimension/N=(n - 1) signal
endif
Duplicate/O signal, windowed
windowed *= Hanning(p, 0, n - 1)
FFT/OUT=3/DEST=magnitude windowed
WAVE magnitude
return magnitude
End
How it works
FFT/OUT=picks what comes back; 3 is magnitude, 1 is complex.- The input length wants to be even; Igor is fussy about that.
- The output's x scaling is frequency, derived from the input's.
Keywords and builtins used here
DuplicateEndFFTFunctionHanningRedimensionVariableWAVEendififmodnumpntsreturn
The run, in numbers
- Lines
- 13
- Characters to type
- 253
- Tokens
- 65
- Three-star pace
- 85 tpm
At the three-star pace of 85 tokens a minute, this run takes about 46 seconds.
Step 2 of 4 in Signals & matrices, step 12 of 16 in Waves & analysis.