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 [bd,ad]=bilinear(bE,aE,Fs); Ndigital = 20000; [h,w]=freqz(bd,ad,Ndigital); 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
I can't pin-point the problem in the code. Why am i getting these results and how do i fix them?