SpHr_DFTSpectrum [ Flags /Mag=[destWaveName] /Phi=[destWaveName] ] srcWaveName [ , srcWaveName2]
Generates magnitude or phase spectra.
Parameters
srcWaveName Specification for single precision source wave.
srcWaveName2 Optional specification for a second source wave. When included, srcWaveName and srcWaveName2 must both have: no columns, identical x-scaling, and the same number of points. Results for srcWaveName and srcWaveName2 are written to destination columns 0 and 1.
Flags
/Mag = [ destWaveName ]
Magnitude (amplitude) spectra. If destWaveName is omitted, the destination wave uses the name of srcWaveName as a prefix and appends "_mag" as a suffix. The wave is single precision and always overwritten.
/Phi = [ destWaveName ]
Phase spectra. If destWaveName is omitted, the destination wave uses the name of srcWaveName as a prefix and appends "_phi" as a suffix. The wave is single precision and always overwritten.
/W A full Hanning window is applied to srcWaveName (and srcWaveName2). Same as /W=0.
/W = [ ms ] Half-length Hanning windows of length ms (milliseconds) are applied at the beginnings and ends of srcWaveName (and srcWaveName2). No window is applied if ms < 0 or if the /W flag is omitted.
/WI = [ windowInput ]
windowInput = 0: Same as no /WI flag. The envelopes of srcWaveName and srcWaveName2 are preserved when using /W flag.
windowInput = 1: Same as /WI flag alone. Windows are applied to srcWaveName (and srcWaveName2).
/N = [ Pnts ] Output points. Spectra are averaged and decimated to obtain an output of length = Pnts.
/F = { Pnts, ProportionOrPnts }
Spectra are obtain using a sliding window (Hanning) of length = Pnts.
Window overlap is determined by ProportionOrPnts.
Values between 0 and 1 indicate the proportion of points overlapped.
Values between 1 and Pnts indicate the number of points to be overlapped.
/dB = [ ref ] Amplitude spectra are converted to decibel equivalents as 20*log10(Pa/ref). If ref is omitted, a default value of 20 µPa (0.00002) is used.
/Oct = [ OctDenom ]
Spectra are smoothed on an octave scale specified by 1/OctDenom.
Example
Function SpHr_DFTSpectrum_Example()
variable fs = 48000
// 1/f noise with 30 Hz Highpass filter
SpHr_SignalGaussian/ms=200/Sp=1/HP=30/dB=70/Ramp=10 fs, Noise
SpHr_DFTSpectrum /Mag=Mag/dB /Oct=6 Noise
Display /W=(49,100,557,364)/K=1 Mag
ModifyGraph log(bottom)=1
Label left "amplitude (\\U)"; Label bottom "frequency (\\U)"
End