What is wrong with my FFT output?

조회 수: 4 (최근 30일)
Pratik Patel
Pratik Patel 2020년 3월 15일
답변: Prabhanjan Mentla 2020년 3월 20일
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
Thiago Henrique Gomes Lobato 2020년 3월 15일
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