%% Bandpass Elliptic Filter Order
% Design a bandpass filter with a passband from 60 Hz to 200 Hz with at most 3 dB of ripple and at least 40 dB attenuation in the stopbands. Specify a sampling rate of 1 kHz. Have the stopbands be 50 Hz wide on both sides of the passband. Find the filter order and cutoff frequencies.

Wp = [60 200]/500;
Ws = [50 250]/500;
Rp = 3;
Rs = 40;

[n,Wp] = ellipord(Wp,Ws,Rp,Rs)

%
% Specify the filter in terms of second-order sections and plot the frequency response.

[z,p,k] = ellip(n,Rp,Rs,Wp);
sos = zp2sos(z,p,k);

freqz(sos,512,1000)
title(sprintf('n = %d Elliptic Bandpass Filter',n))

% Copyright 2015 The MathWorks, Inc.