[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How do I build low pass filter?
From: |
Francesco Potorti` |
Subject: |
Re: How do I build low pass filter? |
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: address@hidden
56126 Pisa - Italy Web: http://fly.cnuce.cnr.it/