You are close. The passband and stopband frequencies must be stated as two-element vectors, and normalised by the Nyquist frequency. You can state the passband and stopband ripple (attenuation) values directly as dB, the function assumes they are negative and represent attenuations or ripple magnitudes.
The elliptical filter is an excellent choice.
Try this:
Fn = Fs/2;
Wp = [700 4.5E+3]/Fn;
Ws = [300 5.5E+3]/Fn;
Rp = 1;
Rs = 40;
[n_b,Wn_b] = ellipord(Wp, Ws, Rp, Rs)
[z,p,k] = ellip(n_b, Rp, Rs, Wp);
[sos, g] = zp2sos(z, p, k);
figure
freqz(sos, 2^14, Fs)
X_Filtered = filtfilt(sos, g, X);
Use the value for ‘Fs’ that your audioread call returns. I used the commented-out value to check my code to be sure it works (no typographical or other errors).
Best Answer