필터 지우기
필터 지우기

1D Gaussian Filter using FFT

조회 수: 8 (최근 30일)
SM
SM 2011년 5월 18일
Hi I am trying to filter data(not periodic) represented by tanh profile.
My steps are -
signal: tanh (x)
ffts = fft(signal)
g = 1D Gaussian Filter normalised by its area
fftg = FFT(g)
fs = ffts.*fftg
s = real(ifft(fs))
But this is not giving the correct output.
What am I doing wrong?
Thanks in advance
SM

답변 (3개)

phani
phani 2011년 5월 18일
dear SM i can suggest you one one of the possible way. the convolution in the time domain is same as the multiplication in the frequency domain. so design a filter using fdatool and obtain the coefficients and do convolution of your signal and the filter coefficients. and compare the ffts of both i.e. FFT without filtering and FFT with filtering. i think that may work.
  댓글 수: 1
SM
SM 2011년 5월 18일
Dear Phani
Thanks for your reply.
I do not want to use fdatool but use a simple gaussian profile like
g = sqrt(6/(pi*s^2))*exp(-6*x.^2/(s^2));
I tried convolution also in this way-
w = conv(S,g,'same');
I fo not get correct result. Do you think this is OK?
Regards
SM

댓글을 달려면 로그인하십시오.


Honglei Chen
Honglei Chen 2011년 5월 18일
Hi SM,
From the code you posted here, my suspect is that you did not use enough points in your FFT to remove the aliasing. Note that ifft of product of fft is, in theory, the circular convolution so you have to use enough points to make it the same as linear convolution. Can you try to use 2*numel(g)-1 as number of FFT points in your snippet and see if it resolves the issue? The 'same' option in CONV merely returns the central part of the linear convolution, which is not the same as the circular convolution.
HTH,
Honglei

SM
SM 2011년 5월 19일
Hi Honglei
Thanks for your reply. I am not sure if I got you correctly.
The filter g has less number of points than the signal s.
So I am kind of padding fft(g) to get the product fs = ffts.*fftg.
I think I am making a mistake there.
Please advise.
Regards
SM

카테고리

Help CenterFile Exchange에서 Frequency Transformations에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by