From help-octave-request at bevo dot che dot wisc dot edu Fri Jan 8 07:20:08 1999 Subject: Re: How do I build low pass filter? From: Francesco Potorti` To: Thomas Hoffmann CC: help-octave at bevo dot che dot wisc dot edu Date: Fri, 8 Jan 1999 14:16:59 +0100 (CET) Can anybody tell how I should proceed to filter out some "spikes" from a vector of data using Octave? Here is an excerpt from a recent .m file of mine where I wanted to apply a low-pass filter with cutoff frequency `cutf' to a series of data `At'. If you want to filter out spikes whose size is approximately 1/100 of the lenght of the sample, set cutf=0.02 or greater. The result is in `Af'. l = length (At); # lenght of the sample Af = detrend(At); # remove linear trend trend = At - Af; # keep trend for later trans = fft(Af); # frequency domain k = round(cutf*l); # frequency cutoff trans(k+2:l-k) = 0; # cut high frequencies Af = real(ifft(trans)) + trend; # put linear trend back in -- Francesco Potort́ (researcher) Voice: +39-050-593 203 (op. 211) Computer Networks Group Fax: +39-050-904052 CNUCE-CNR, Via Santa Maria 36 Email: F dot Potorti at cnuce dot cnr dot it 56126 Pisa - Italy Web: http://fly.cnuce.cnr.it/