Low Pass filter not working
Show older comments
I audioread() a signal and tried to apply low-pass filtering but it does not seem to have any change at all. The signal is a recording of lung sound and I wish to filter out the noise component.
[y,Fs] = audioread('mysound.wav')
Fs = 44100; % Sampling Frequency (Hz)
Fn = Fs/2; % Nyquist Frequency
Fco = 70; % Passband (Cutoff) Frequency
Fsb = 100; % Stopband Frequency
Rp = 1; % Passband Ripple (dB)
Rs = 10; % Stopband Ripple (dB)
[n,Wn] = buttord(Fco/Fn, Fsb/Fn, Rp, Rs); % Filter Order & Wco
[b,a] = butter(n,Wn); % Lowpass Is Default Design
[sos,g] = tf2sos(b,a);
filt_sig = filtfilt(sos,g,y)
Neither the plot(), FFT() or soundsc() shows anything different. I've tried cheby filters as well. Am I doing anything wrong? Thanks for the help.
2 Comments
You would have to provide your data, or at least show the timeseries before and after, and the fft before and after filtering. As for soundsc, I suspect either your speakers do not play low-end frequencies very well, or the SNR of the signal is low below your cutoff frequency.
What does your noise consist of? This changes how you approach the filter.
Is it evenly distributed, white noise?
Is the noise separated from your signal spectrally?
Is the noise from a particular, characteristic external source?
Yipp Chun Munn
on 16 Oct 2019
Accepted Answer
More Answers (1)
You show a figure that essentially looks like the following (also attached):
fs = 1000;
t = 0:1/fs:10;
x = sin(2*pi*10*t);
X = fft(x);
figure
plot(abs(X))
This is completely normal. It is the two sided amplitude spectrum.
You should read more about fftshift, and follow the example for the single sided amplitude spectrum on page for fft.
"No matter what filter I apply, the Far right frequency components does'nt go away."
That's because they're not supposed to.
Categories
Find more on Digital Filter Design in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



