Remove the 50 Hz Hum from a Signal
22 ビュー (過去 30 日間)
古いコメントを表示
I have a signal which contains 40Hz and 50Hz values and it's FFT is like:
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:
does anyone know where is the problem?
U which contains 40 and 50Hz signals is :
0 件のコメント
回答 (1 件)
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).
0 件のコメント
参考
カテゴリ
Help Center および File Exchange で Digital Filter Analysis についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!