On 2=D4=C24=C8=D5, =CF=C2=CE=E75=CA=B128=B7=D6, Wox <nom...@[EMAIL PROTECTED]
>
wro=
te:
> On Sat, 2 Feb 2008 11:27:47 -0800 (PST), jdu.u...@[EMAIL PROTECTED]
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=3D2.
> freq2=3D3.
> freq3=3D4.
> dtime=3D0.1
> ntime=3D1000
> time=3Ddtime*findgen(ntime)
>
signal=3Dsin(2*!pi*freq1*time)+sin(2*!pi*freq2*time)+sin(2*!pi*freq3*time)=
>
> ; Frequency domain
> nfreq=3Dntime/2+1
> freq=3Dfindgen(nfreq)/(dtime*ntime)
> fsignal=3Dfft(signal)
>
> ; Time domain Filter
> f_low =3D 0
> f_high =3D 2.5
> timefilter =3D DIGITAL_FILTER(f_low*2*dtime, f_high*2*dtime, 50.,40)
> signal=3Dconvol(signal,timefilter)
>
> ; Time domain Filter in Frequency domain
> ntime2=3Dn_elements(timefilter)
> nfreq2=3Dntime2/2+1
> freq2=3Dfindgen(nfreq2)/(dtime*ntime2)
> ftimefilter=3Dfft(timefilter,1); =3D=3D ntime2*fft(timefilter)
>
> ; Frequency domain filter (instead of time domain filter)
> steep=3D50.
> freqfilter=3D 1./(1.+(freq/f_high)^steep)
> fsignal*=3Dfreqfilter
>
> ; Plot
> window,0
>
plot,freq,abs(fsignal[0:nfreq-1])^2,xtitle=3D'frequency',ytitle=3D'spectru=
m',title=3D'Time
> domain filtered'
> window,1
>
plot,freq,abs((fft(signal))[0:nfreq-1])^2,xtitle=3D'frequency',ytitle=3D's=
pectrum',title=3D'Freq
> domain filtered'
> window,2
>
plot,freq,abs(freqfilter)^2,yrange=3D[0,1.1],ystyle=3D1,xtitle=3D'frequenc=
y',ytitle=3D'spectrum',title=3D'Filters'
> oplot,freq2,abs((ftimefilter)[0:nfreq2-1])^2,col=3D128
In this example, max(abs(fsignal[0:nfreq-1])^2) =3D 0.249995 and
max(abs((fft(signal))[0:nfreq-1])^2) =3D 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=3Dfft(timefilter,1); =3D=3D 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


|