0
$\begingroup$

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

and i am expecting a filter with my desired frequencies but get this: High-Pass Filter Resulting from the Code

I can't pin-point the problem in the code. Why am i getting these results and how do i fix them?

$\endgroup$
0
$\begingroup$

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.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.