digital_filter [message #58327] |
Mon, 28 January 2008 06:46  |
claire.maraldi
Messages: 4 Registered: January 2006
|
Junior Member |
|
|
Hi,
I have a problem of comprehension with the digital filter tool.
I have an array "X" of n elements, the delta between two elements is
"1unit"
I would like to creat a pass band filter between 1unit and 60 units
In IDL I write
; Filtre : 1unit<T<60unit ;
delta=1. ;
f_low=1./(60.*1.)
f_high=1./(1.*1.)
a_ripple=50. & nterms=40.
coeff=DIGITAL_FILTER(f_low*2*delta, f_high*2*delta, a_ripple, nterms)
X_filter=convol(REFORM(X),coeff,/EDGE_TRUNCATE)
Then when I compute FFT(X_filter), I see than my signal has been cut
between 1 unit and more than 60units (about 100 units). Are my
definitions of f_low and f_high wrong, or is this a problem related to
the digital_filter function ?
Thanks
Claire
|
|
|
Re: digital_filter [message #58382 is a reply to message #58327] |
Tue, 29 January 2008 05:13  |
Wox
Messages: 184 Registered: August 2006
|
Senior Member |
|
|
On Mon, 28 Jan 2008 06:46:07 -0800 (PST), claire.maraldi@gmail.com
wrote:
> Hi,
>
> I have a problem of comprehension with the digital filter tool.
>
> I have an array "X" of n elements, the delta between two elements is
> "1unit"
> I would like to creat a pass band filter between 1unit and 60 units
>
> In IDL I write
>
> ; Filtre : 1unit<T<60unit ;
> delta=1. ;
> f_low=1./(60.*1.)
> f_high=1./(1.*1.)
> a_ripple=50. & nterms=40.
> coeff=DIGITAL_FILTER(f_low*2*delta, f_high*2*delta, a_ripple, nterms)
>
> X_filter=convol(REFORM(X),coeff,/EDGE_TRUNCATE)
>
>
> Then when I compute FFT(X_filter), I see than my signal has been cut
> between 1 unit and more than 60units (about 100 units). Are my
> definitions of f_low and f_high wrong, or is this a problem related to
> the digital_filter function ?
>
> Thanks
> Claire
If you plot the filter in the fequency domain, do you get what you
expect?
nfilt = N_ELEMENTS(coeff)
filter_fourier = FFT(coeff)*nfilt
f_filt = FINDGEN(nfilt/2+1) / (nfilt*delta)
mag = ABS(filter_fourier[0:nfilt/2])
plot,f_filt,alog(mag)
You can off course do the filtering in the fequency domain instead:
x_filtered = fft(fft(x,1)*filter,-1)
For the filter see e.g.
http://msi.umn.edu/software/idl/tutorial/idl-signal.html
|
|
|