comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » How to perform the 1-D signal filter?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: How to perform the 1-D signal filter? [message #58544 is a reply to message #58441] Sat, 02 February 2008 11:27 Go to previous messageGo to previous message
jdu is currently offline  jdu
Messages: 7
Registered: February 2008
Junior Member
There is another question about the filter example.
The code of example is below:

; Time domain
freq1=2.
freq2=3.
freq3=4.
dtime=0.1
ntime=1000

time=dtime*findgen(ntime)
signal=sin(2*!pi*freq1*time)+sin(2*!pi*freq2*time)+sin(2*!
pi*freq3*time)

; Time domain Filter
f_low = 0
f_high = 2.5
timefilter = DIGITAL_FILTER(f_low*2*dtime, f_high*2*dtime, 50.,40)
signal_1=convol(signal,timefilter)
fsignal_1=fft(signal_1)


; Frequency domain
nfreq=ntime/2+1

freq=findgen(nfreq)/(dtime*ntime)
fsignal=fft(signal)

; Frequency domain filter (instead of time domain filter)
steep=100.d
y=1./(1.+(freq/f_high)^steep)
freqfilter=[y[0:nfreq-2],reverse(y[0:nfreq-2])]
fsignal_2=fsignal*freqfilter
signal_2=fft(fsignal_2,1)

window,/free
plot,freq,abs(fsignal[0:nfreq-1])^2,title='Orignal
Data',xtitle='frequency',ytitle='spectrum'
window,/free
plot,freq,abs(fsignal_1[0:nfreq-1])^2,title='Filter in Time
domain',xtitle='frequency',ytitle='spectrum'
window,/free
plot,freq,abs(fsignal_2[0:nfreq-1])^2,title='Filter in Frequency
domain',xtitle='frequency',ytitle='spectrum'


I found that the the value of the peak in the second figure is lower
than those in first and third figure. Why does it happen?
And the filtered signal_1 is not equal to the real part of signal_2.
Does it mean that the filter in time domain is not exactly equal to it
in frequency domain?

Du
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Re: explain THIS one
Next Topic: Re: Interesting Workbench Experience

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 10 03:13:36 PDT 2025

Total time taken to generate the page: 0.00632 seconds