%Demo done during Session 18 demonstrating
%efficacy of FIR Bandpass Filter design via
%Remez Exchange Algorithm (Parks-McClellan)
clf
set(0,'defaultaxesfontsize',20);
F=[0 .15 .35 .65 .9 1];
W=[1 1 1];
hbp=remez(25,F,[0 0 1 1 0 0],W);
N=512;
hbpfft=fftshift(fft(hbp,N));
subplot(211)
hbpmag=20*log10(abs(hbpfft));
hbpmag=hbpmag-max(hbpmag);
hbpang=angle(hbpfft);
freqomega=linspace(-pi,pi,N);
plot(freqomega,hbpmag,'Linewidth',4);
miny=max(-100,min(hbpmag));
axis([-pi pi miny 0]);
title('Bandpass Filter Magnitude Response'),...
xlabel('Omega'), ylabel('Magnitude'), grid
hold on
for m=1:length(F),
plot([pi*F(m) pi*F(m)],[miny 0],'r--','Linewidth',4);
end
hold off
subplot(212)
plot(freqomega,hbpang,'Linewidth',4);
axis([-pi pi -pi pi]);
title('Phase Response'),...
xlabel('Omega'), ylabel('Phase'), grid
