In: Electrical Engineering
Design an analog elliptic lowpass IIR filter with specifications Fp=10 kHz., Ap=1 dB, Fs=15 kHz. And As=50 dB. Provide the following plots in MATLAB:
a. Magnitude
b. Log-magnitude
c. Group-delay
d. Impulse response
e. Pole-zero
Code:
clc;close all;clear all;
fp=10000; fs=15000;Ap=1;As=50;
Fs=40000;wp=2*fp/Fs; ws=2*fs/Fs;
%Elliptic Filter
[N,wp] = ellipord(wp,ws,Ap,As);
[b,a] = ellip(N,Ap,As,wp,'s');
w=0:pi/1000:pi;
[H,w]=freqs(b,a,w);
figure;
subplot(221)
n=0:1:20;
h=impz(b,a,21);
stem(n,h);grid;
xlabel('n')
ylabel('h(n)')
title('Impulse response')
subplot(222)
plot(w/pi,abs(H));grid;
xlabel('w/pi');ylabel('|H(w)|');
title('Magnitude response')
subplot(223)
plot(w/pi,20*log10(abs(H)));grid;
xlabel('w/pi');ylabel('|H(w)|');
title('Log Magnitude response')
gd=grpdelay(b,a,w);
subplot(224)
plot(w/pi,gd);grid;
xlabel('w/pi');ylabel('|H(w)|');
title('Group delay')
figure;
sys=tf(b,a);
pzplot(sys)