typestar

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

  1. FFT/OUT= picks what comes back; 3 is magnitude, 1 is complex.
  2. The input length wants to be even; Igor is fussy about that.
  3. The output's x scaling is frequency, derived from the input's.

Keywords and builtins used here

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.

Type this snippet

Step 2 of 4 in Signals & matrices, step 12 of 16 in Waves & analysis.

← Previous Next →