# Why do cutoff frequencies of a high-pass digital filter differ from the ones i used to transform it from a low-pass analog filter in MATLAB?

I need to transform an elliptic analog low-pass filter to a digital high-pass filter but i'm having a problem because the resulting filter has lower cutoff frequencies than the ones i set. Here is the code sample from MATLAB:

Fs = 44100; %Sampling rate
Rp = 0.05;
Rs = 60;

Wp = 2*pi*10000; %Cutoff frequencies of my high-pass filter
Ws = 2*pi*9700;

WsE= Wp/Ws; %LP->HP transformation for the analog stopband frequency
WpE=1

k=sqrt(1-(WpE/WsE)^2); %Elliptic filter calculation of N
D=(10^(0.1*Rs)-1)/(10^(0.1*Rp)-1);
q0=(1/2)*((1-sqrt(k))/(1+sqrt(k)));
q=q0+2*q0^5+15*q0^9+150*q0^13;
N=ceil(log10(16*D)/(log10(1/q)));

[z,p,k]=ellipap(N,Rp,Rs); %Making the analog prototype
bE=k*poly(z);aE=poly(p);

[bE,aE]=lp2hp(bE,aE,Wp); %Transforming the low-pass into a high-pass

Ndigital = 20000;
H=abs(h);

f = w/(2*pi)*Fs; % Ploting the filter
figure(1);
plot(f,20*log10(H), 'LineWidth', 2);
xlabel('Hz');
ylabel('|H(z)|');
pause


and i am expecting a filter with my desired frequencies but get this: I can't pin-point the problem in the code. Why am i getting these results and how do i fix them?

The bilinear transform warps the frequency axis, that's why cut-off frequencies of the analog filter are not necessarily mapped to the correct frequencies in the digital domain. You can use the prewarping option by providing an optional parameter to bilinear.m. Check the corresponding mathworks documentation.