Remove the 50 Hz Hum from a Signal

조회 수: 26 (최근 30일)
Ajira
Ajira 2019년 12월 11일
답변: Star Strider 2019년 12월 11일
I have a signal which contains 40Hz and 50Hz values and it's FFT is like:
untitled.png
how can I remove 50Hz signal from it?
I tried second order filter but it getting worse: here is the filter code :
d = designfilt('bandstopiir','FilterOrder',2, ...
'HalfPowerFrequency1',49,'HalfPowerFrequency2',51, ...
'DesignMethod','butter','SampleRate',Fs);
and then: where u is the input signal,
filtering = filtfilt(d,u);
the result is:
untitled1.png
does anyone know where is the problem?
U which contains 40 and 50Hz signals is :
untitled3.png

답변 (1개)

Star Strider
Star Strider 2019년 12월 11일
The designfilt call designs a second-order Butterworth filter. It appears to be correct when I analyse it with freqz. Without seeing your data, it is not possible to determine what the problem is.
An alternative filter design is:
Fs = 900; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Wp = [48 52]/Fn; % Stopband Frequency (Normalised)
Ws = [0.9 1.1].*Wp; % Passband Frequency (Normalised)
Rp = 1; % Passband Ripple
Rs = 90; % Passband Ripple (Attenuation)
[n,Wp] = ellipord(Wp,Ws,Rp,Rs); % Elliptic Order Calculation
[z,p,k] = ellip(n,Rp,Rs,Wp,'stop'); % Elliptic Filter Design: Zero-Pole-Gain
[sos,g] = zp2sos(z,p,k); % Second-Order Section For Stability
figure
freqz(sos, 2^18, Fs) % Filter Bode Plot
set(subplot(2,1,1), 'XLim',[0 Fs/5]) % Optional
set(subplot(2,1,2), 'XLim',[0 Fs/5]) % Optional
filtering = filtfilt(sos, g, u); % Filter Signal
Provide the correct sampling frequency (I assume it is 900 Hz from the fft plot).

카테고리

Help CenterFile Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by