%
% Chebyshev highpass design
%
% Step 1: define pass and stop frequencies
wph=165; wsh=100; Gp=-2; Gs=-20;

% Step 2: determine n
r=-Gp;
wp=1; ws=wph/wsh;
P1=-Gs/10; P2=r/10; Wsp=ws/wp;
nc=acosh( sqrt( (10^P1-1)/(10^P2-1) ) )/(acosh(Wsp));
n= ceil(nc);
fprintf('Filter order is %i\n', n)

% Step 3: determine transfer function of prototype low pass
[num1, den1] = cheby1(n, r, wp, 's');

% Display prototype low pass transfer function
disp('The prototype lowpass transfer function is')
format short e
num1, den1

% Step 4 design analog high pass
[num1, den1] = cheby1(n, r, wph, 'high', 's');

%  Now display final filter transfer function
disp('The final transfer function is')
num1, den1
format
