Discrete Fourier transform macros from waves in target graph

These two functions allow you to use the macros DFTMagPhase and DFTAtOneFrequency with the wave list limited to the waves on the target graph.
Prevents you from having to scroll through potentially hundreds of waves before finding the one you want to analyze.
Just make sure the current data folder is set to the location of the wave of interest.
Credit goes to Larry Hutchinson, who developed this for me, but I figured it was useful enough to post.

//#include <DFTMagPhase> must be placed in one of the procedure files to access the macros
Macro DFTMagPhaseFromTarget(w,window,fMin,fMax,numout,linlog,phase,phasetype)
    string w
    Prompt w,"Input data:",popup WaveList("*",";","WIN:") // only top table or graph
    variable window=1
    Prompt window,"Windowing:",popup "None;Hann"
    variable fMin=0
    Prompt fMin,"Minimum frequency"
    variable fMax=0
    Prompt fMax,"Maximum frequency, or 0 for Nyquist"
    variable numout=65  // small value recommended.  Remember, we're using the DFT, not the FFT
    Prompt numout,"Number of output points:"
    variable linlog= 2
    Prompt linlog,"Magnitude mode:",popup "Linear;dB"
    Variable phase= 0.5
    Prompt phase,"Phase:",popup "No phase;Phase in radians;Phase in degrees"
    Variable phasetype=1
    Prompt phasetype,"Unwrap phase?",popup,"No;Yes"


Macro DFTAtOneFrequencyFromTarget(w,freq,phase,printit)
    string w
    Prompt w,"Input data:",popup WaveList("*",";","WIN:")
    Variable freq
    Prompt freq,"DFT at frequency (Hz):"
    Variable phase= 1
    Prompt phase,"Phase:",popup "Phase in radians;Phase in degrees"
    Variable printit= 1
    Prompt printit,"Results:",popup "Printed to History;Not Printed"





Igor Pro 9

Learn More

Igor XOP Toolkit

Learn More

Igor NIDAQ Tools MX

Learn More