MATLAB: Low Pass filter not working

filterlowpasslungMATLAB

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.

Best Answer

Your stopband attenuation is likely not sufficient to produce any difference.
Try this instead:
Rs = 60; % Stopband Ripple (dB)
Increase ‘Rs’ (to increase the stopband attenuation) as necessary to get the result you want.
Also, always use freqz (or similar functions) to see what your filter is doing:
figure
freqz(sos, 2^14, Fs)
Related Question