An equivalent elliptic filter (essentially the same one the bandpass function would design):
Fs = 1000;
Fn = Fs/2;
Wp = [100 200]/Fn;
Ws = [ 90 210]/Fn;
Rp = 1;
Rs = 50;
[n,Wp] = ellipord(Wp,Ws,Rp,Rs);
[z,p,k] = ellip(n,Rp,Rs,Wp);
[sos,g] = zp2sos(z,p,k);
figure
freqz(sos, 2^16, Fs)
x_filt = filtfilt(sos, g, x);
Here, ‘x’ is the signal vector. To reproduce the plot, create an equivalent signal (this one from the bandpass documentation page):
fs = 1e3;
t = 0:1/fs:1;
x = [2 1 2]*sin(2*pi*[50 150 250]'.*t) + randn(size(t))/10;
then apply my filter design to it.
To create the second plot, divide the fft of ‘x_filt’, by the fft of ‘x’ using element-wise division, then plot as you normally would plot the fft. See fft for details.
Best Answer