Remove specific frequencies from FFT signal and reconstruct the signal after filtering those frequencies

조회 수: 64 (최근 30일)
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];

채택된 답변

Bjorn Gustavsson
Bjorn Gustavsson 2020년 11월 12일
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
paloma paleo
paloma paleo 2020년 12월 7일
I can see the issue. I am not too queen to use a 'semi-manually' method since I have a huge number of tests and it would be tricky.
I am not sure what your low-pass filtering does. The type of filter that I need, it is a very simple. I just want to remove the values of the signal from certain frequency. In my case, the frequency is factor of the rotational speed, so I can use e.g., 5x rpm to define the threshold of the frequency. All values with higher frequency than the threshold will be consider a noise. So I would like a filter that only takes in considaration the frequency value.
I have been reading about the type of filters and how to define them and I believe I need something really simple. The type of filters that I found are too fancy for what I need. I work also with image procesing/anaylisis.
So I thought that something like
yl = lowpass(I_raw,fpass,fs);
But I am not 100% sure if this is the correct filter.
Thanks again for you kind responses.
Bjorn Gustavsson
Bjorn Gustavsson 2020년 12월 7일
편집: Bjorn Gustavsson 2020년 12월 7일
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.

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

추가 답변 (0개)

카테고리

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by