What is wrong with my FFT output?

3 次查看(过去 30 天)
Hey, I am trying to use the fft function to clear up noise on a dataset. Here is my code:
load('Homework4_set1.mat');
D = data;
t=D(:,1);
a = D(:,2);
N=length(a);
N2=floor((N-1)/2)
plot(t,a)
c=polyfit(t,a,1);
trend=polyval(c,t);
plot(t,a,t,trend)
y=a-trend;
Y=fft(y);
Fs = 2*pi
f=(0:N2)*Fs/N;
Y2=abs(Y(1:N2+1))*2/N;
plot(f,Y2)
Here are my outputs:
This is the graph of the dataset. When you zoom in, you can see the noise. When I use the fft function, this my output:
The issue here is that this output should be the same as the first plot, but when you zoom in you don't see the noise. The noise has been eliminated because of the fft function. Is there something wrong with the code? Am I supposed to the ifft function to smooth out the curve?
  1 个评论
Thiago Henrique Gomes Lobato
Try to first understand what you want to do. Why use FFT to denoise the signal? Your signal has a specific frequency? What about the noise? Then what do the FFT actually do, it is just a denoising? The domain of the signal remains the same after FFT? Why one need an IFFT?
There's nothing wrong with the code, but you aren't doing any denoise. Try to reflect about the above questions to find the things that are missing.

请先登录,再进行评论。

回答(1 个)

Prabhanjan Mentla
Prabhanjan Mentla 2020-3-20
You can use a low pass filter to remove noise, first FFT followed by low pass filter then IFFT may work. I guess the spike in initial part of FFT signal is due to noise.
Try checking with FFT then different filters.
This link may help.

类别

Help CenterFile Exchange 中查找有关 Fourier Analysis and Filtering 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by