%% Lowpass to Highpass Transformation
% Design a 5th-order highpass elliptic filter with a cutoff frequency of 100 Hz, 3 dB of passband ripple, and 30 dB of stopband attenuation
%
% Design the prototype. Convert the zero-pole-gain output to a transfer function.

f = 100;

[ze,pe,ke] = ellipap(5,3,30);
[be,ae] = zp2tf(ze,pe,ke);

%
% Transform the prototype to a highpass filter. Specify the cutoff frequency in rad/s.

[bh,ah] = lp2hp(be,ae,2*pi*f);

% Compute and plot the frequency response of the filter. Divide the normalized frequency by 2\pi so the x-axis of the plot is in Hz.

[hh,wh] = freqs(bh,ah,4096);

semilogx(wh/2/pi,mag2db(abs(hh)))
axis([10 400 -40 5])
grid

% Copyright 2012 The MathWorks, Inc.