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 #58529 is a reply to message #58441] Mon, 04 February 2008 08:48 Go to previous messageGo to previous message
jdu is currently offline  jdu
Messages: 7
Registered: February 2008
Junior Member
On 2月4日, 下午5时28分, Wox <nom...@hotmail.com> wrote:
> On Sat, 2 Feb 2008 11:27:47 -0800 (PST), jdu.u...@gmail.com wrote:
>> 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?
>
> Well, I'm not sure. If you execute the code below, you will see that
> the two filters are similar. Maybe this is just the result of the
> intrinsic approximation of time domain filtering?
>
> ; 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)
>
> ; Frequency domain
> nfreq=ntime/2+1
> freq=findgen(nfreq)/(dtime*ntime)
> fsignal=fft(signal)
>
> ; Time domain Filter
> f_low = 0
> f_high = 2.5
> timefilter = DIGITAL_FILTER(f_low*2*dtime, f_high*2*dtime, 50.,40)
> signal=convol(signal,timefilter)
>
> ; Time domain Filter in Frequency domain
> ntime2=n_elements(timefilter)
> nfreq2=ntime2/2+1
> freq2=findgen(nfreq2)/(dtime*ntime2)
> ftimefilter=fft(timefilter,1); == ntime2*fft(timefilter)
>
> ; Frequency domain filter (instead of time domain filter)
> steep=50.
> freqfilter= 1./(1.+(freq/f_high)^steep)
> fsignal*=freqfilter
>
> ; Plot
> window,0
> plot,freq,abs(fsignal[0:nfreq-1])^2,xtitle='frequency',ytitl e='spectrum',title='Time
> domain filtered'
> window,1
> plot,freq,abs((fft(signal))[0:nfreq-1])^2,xtitle='frequency' ,ytitle='spectrum',title='Freq
> domain filtered'
> window,2
> plot,freq,abs(freqfilter)^2,yrange=[0,1.1],ystyle=1,xtitle=' frequency',ytitle='spectrum',title='Filters'
> oplot,freq2,abs((ftimefilter)[0:nfreq2-1])^2,col=128

In this example, max(abs(fsignal[0:nfreq-1])^2) = 0.249995 and
max(abs((fft(signal))[0:nfreq-1])^2) = 0.211242.
The peak of spectra in window 0 is not equal to it in window 1.
Does this difference between them result from the arithmetical errors
of the filters?
Is there any methods to eliminate it?


> ftimefilter=fft(timefilter,1); == ntime2*fft(timefilter)
Besides, I don't know why you use the inverse transform instead of
the forward transform in IDL to caculate ftimefilter.

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 06:09:48 PDT 2025

Total time taken to generate the page: 0.56076 seconds