SpHr_WavePeaks [ flags ] srcWaveName
Finds waveform maxima (peaks) or RMS amplitudes along srcWaveName rows. Used to summarize (decimate) long waveforms for displaying.
Parameters
srcWaveName Specification for source wave. srcWaveName is overwritten if the /Dest flag is omitted.
Flags
/N [ = n ]
Number of desired output points. The actual number of points generated may not be exactly equal to n.
/RMS [ = rms ]
Results indicate RMS amplitudes as opposed to maximal (peak) waveform values.
/RMS=0: Same as no /RMS at all. Default option.
/RMS=1: Same as /RMS alone.
/dB = [ ref ]
Results are converted to decibel equivalents using the operation 20*log10(Pa/ref). If ref is omitted, a default value of 20 µPa (0.00002 Pa) is used.
/Q [ = q ]
Quiet. If the /Q flag is omitted or q is not set to 0, the following statistics and variables are set: V_MindB, V_MaxdB, V_AvgdB, V_MediandB, V_Q1dB, V_Q2dB (same as V_MediandB), V_Q3dB.
/Dest [ = destWaveName ]
Peaks are written to a wave specified by destWaveName. The wave is single precision and always overwritten. If destWaveName is omitted, peaks are written to a wave having the same name as srcWaveName plus the suffix "_peaks", or if the /RMS flag is used, the suffix "_rms".
Example
Function SpHr_WavePeaks_Example()
variable fs = 48000
SpHr_SignalGaussian/ms=500/Sp=1/HP=10/dB=70/Ramp=20 fs, Noise
SpHr_WavePeaks/Dest=NoisePeaks/N=200 Noise
// Display
Display /W=(71,225,432,520)/K=1 Noise,NoisePeaks as "Ramped Noise"
ModifyGraph width=288,height=216
ModifyGraph rgb(Noise)=(48059,48059,48059),rgb(NoisePeaks)=(0,0,0)
ModifyGraph tick=2,fSize=10,lblMargin=3,standoff=0,axThick=0.5
ModifyGraph ZisZ=1,zapTZ=1,zapLZ=1
ModifyGraph btLen=4,btThick=0.5,stLen=2,stThick=0.5
Label left "amplitude (\\U)"
Label bottom "time (\\U)"
TextBox/C/N=text0/F=0/H={15,0,5}/B=1/A=MT/E "\\s(Noise) noise\r\\s(NoisePeaks) peaks"
End