What is wrong with my FFT output?

5 visualizzazioni (ultimi 30 giorni)
Pratik Patel
Pratik Patel il 15 Mar 2020
Risposto: Prabhanjan Mentla il 20 Mar 2020
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 Commento
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.

Accedi per commentare.

Risposte (1)

Prabhanjan Mentla
Prabhanjan Mentla il 20 Mar 2020
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.

Categorie

Scopri di più su Fourier Analysis and Filtering in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by