Filtering
Carlo
my tutor wrote these two procedures to apply a manual system of filtering (high pass and low pass) to my wave (that was acquired at 10 kHz).
How can I improve these procedure? Are correct?
Function/WAVE vibrationhighpass(wavein, win, waveoutname)
wave wavein
variable win
String waveoutname
make/O/N=(numpnts(wavein)-win+1) wavetmp, waveout, waveout2
wavetmp= wavein[win/2+p-1]
waveout=sum(wavein, pnt2x(wavein, p), pnt2x(wavein, p+win-1))/win // moving average 1 Hz
waveout2=wavetmp-waveout
duplicate/O waveout2, $waveoutname
Wave wOut=$waveoutname
wOut=waveout2
end
Function/WAVE lowpass(wavein, win, waveoutname)
wave wavein
variable win
String waveoutname
make/O/N=(numpnts(wavein)-win+1) wavetmp, waveout2
wavetmp= wavein[win/2+p-1]
waveout2=sum(wavein, pnt2x(wavein, p), pnt2x(wavein, p+win-1))/win // moving average 1 Hz
//waveout2=wavetmp-waveout
duplicate/O waveout2, $waveoutname
Wave wOut=$waveoutname
wOut=waveout2
end
wave wavein
variable win
String waveoutname
make/O/N=(numpnts(wavein)-win+1) wavetmp, waveout, waveout2
wavetmp= wavein[win/2+p-1]
waveout=sum(wavein, pnt2x(wavein, p), pnt2x(wavein, p+win-1))/win // moving average 1 Hz
waveout2=wavetmp-waveout
duplicate/O waveout2, $waveoutname
Wave wOut=$waveoutname
wOut=waveout2
end
Function/WAVE lowpass(wavein, win, waveoutname)
wave wavein
variable win
String waveoutname
make/O/N=(numpnts(wavein)-win+1) wavetmp, waveout2
wavetmp= wavein[win/2+p-1]
waveout2=sum(wavein, pnt2x(wavein, p), pnt2x(wavein, p+win-1))/win // moving average 1 Hz
//waveout2=wavetmp-waveout
duplicate/O waveout2, $waveoutname
Wave wOut=$waveoutname
wOut=waveout2
end
Why not use Igor 6's Filter... dialog in the Analysis menu?
--Jim Prouty
Software Engineer, WaveMetrics, Inc.
May 19, 2016 at 03:22 pm - Permalink