Remove specific frequencies from FFT signal and reconstruct the signal after filtering those frequencies
205 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
paloma paleo
le 12 Nov 2020
Modifié(e) : Bjorn Gustavsson
le 7 Déc 2020
Hi,
I have a signal that shows a very distinctive peaks in the FFT.
Those high amplitudes are the 'noise' of the signal. I would like to remove that values from the original signal and to plot the filtered signal.
Fs = 4500; % Sampling frequency (fps)
T = 1/Fs; % Sampling period (s)
L = 900; % Length of signal (how many frames)
tt = (0:L-1)*T; % Time vector
thickness = detrend(thickness);
Y = fft(thickness);
P2 = abs(Y/L);
P1 = P2(1:L/2+1);
P1(2:end-1) = 2*P1(2:end-1);
f = Fs*(0:(L/2))/L;
figure(1111)
h1=plot(f(1:end),P1(1:end)) ;
title('Amplitude Spectrum')
xlabel('f [Hz]')
ylabel('Power [mm]')
ylim auto
[B,IX] = sort(P1); %order the amplitudes
A1=B(end); %amplitude of the first peak
A2=B(end-1); %amplitude of second peak
f1=f(IX(end)); %frequency of first peak
f2=f(IX(end-1)); %frequency of second peak
AmpTab=[A1 A2];
FreTab=[f1 f2];
0 commentaires
Réponse acceptée
Bjorn Gustavsson
le 12 Nov 2020
Those high amplitudes are a noise in the signal. Not the noise in the signal. To remove such interference-components you will be better off doing it this way (remember the Fourier-transform of a real signal has symmetric real components and an anti-symmetric imaginary components, and also that the DC-component is real.):
fD = fft(data_t_tichkness(:,2)); % Discrete Fourier-transform of your data
subplot(2,1,1)
plot(abs(fD)) % Plot of its absolute values
hold on
[safD,idx] = sort(abs(fD),'descend'); % Sort in descending order, this makes indexing simpler
plot(idx(2:5),abs(fD(idx(2:5))),'r.') % DC-component will be the first, then
% the positive and negative components will
% have equal magnitudes and appear consecutively in idx
fD(idx(2:5)) = 0; % Set the Fourier-components of the first and second spike to zero.
plot(abs(fD)) % Yup, they're gone.
subplot(2,1,2)
ifD = ifft(fD); % inverse-Fourier-transform
plot(data_t_tichkness(:,2))
hold on
plot(ifD)
HTH
7 commentaires
Bjorn Gustavsson
le 7 Déc 2020
Modifié(e) : Bjorn Gustavsson
le 7 Déc 2020
Well the lowpass filter should do what you want. If you're unsure about the filter characteristics you can reasonably easy simply check the documentation (it contains a lot of juicy information!), test what frequency response you get from a single delta-spike as input etc.
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!