Filtering

Hi everyone,
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
These filters are pretty crude rectangular window filters.

Why not use Igor 6's Filter... dialog in the Analysis menu?

--Jim Prouty
Software Engineer, WaveMetrics, Inc.