Graph the frequency response of an FIR filter designed using the Parks-McClellan algorithm that meets the specification in Figure E.20 with the shortest possible impulse response.
% Program to design an optimal equiripple FIR filter using the
% Parks-McClellan method
close all ; figure('Position',[20,20,1500,800]) ;
Omega = [0,0.4,0.45,1.35,1.4,1.85,1.9,2.7,2.75,pi] ;
F = Omega/pi ;
AdB = [-800,-800,3.5,3.5,-900,-900,3.5,3.5,-800,-800] ;
A = 10.^(AdB/20) ;
N = 244 ; wts = [1,0.04,1,0.04,1] ;
b = firpm(N,F,A,wts) ;
a = 1 ;
[Hd,W] = freqz(b,a,1000) ;
specx1 = [0,0.4,0.4,1.4,1.4,1.85,1.85,2.75,2.75,pi,pi,0,0] ;
specy1 = [-40,-40,4,4,-50,-50,4,4,-40,-40,20,20,-40] ;
specx2 = [0.65,0.65,1.15,1.15,0.65] ;
specy2 = [-60,3,3,-60,-60] ;
specx3 = [2,2,2.6,2.6,2] ;
specy3 = [-60,3,3,-60,-60] ;
subplot(2,1,1) ;
ptr = patch(specx1,specy1,[0.5,0.5,0.5]) ;
hold on ;
ptr = patch(specx2,specy2,[0.5,0.5,0.5]) ;
ptr = patch(specx3,specy3,[0.5,0.5,0.5]) ;
ptr = plot(W,20*log10(abs(Hd)),'k') ; set(ptr,'LineWidth',2) ;
hold off ;
axis([0,pi,-60,20]) ;
grid on ;
xlabel('\Omega','FontName','Times','FontSize',24) ;
ylabel('|H_{\itd}({\ite}^{{\itj}\Omega})|','FontName','Times','FontSize',24) ;
set(gca,'FontSize',18,'FontName','Times') ;
subplot(2,5,6) ;
ptr = patch(specx1,specy1,[0.5,0.5,0.5]) ;
hold on ;
ptr = patch(specx2,specy2,[0.5,0.5,0.5]) ;
ptr = patch(specx3,specy3,[0.5,0.5,0.5]) ;
ptr = plot(W,20*log10(abs(Hd)),'k') ; set(ptr,'LineWidth',2) ;
hold off ;
axis([0,0.65,-50,-30]) ;
grid on ;
xlabel('\Omega','FontName','Times','FontSize',24) ;
ylabel('|H_{\itd}({\ite}^{{\itj}\Omega})|','FontName','Times','FontSize',24) ;
set(gca,'FontSize',18,'FontName','Times') ;
subplot(2,5,7) ;
ptr = patch(specx1,specy1,[0.5,0.5,0.5]) ;
hold on ;
ptr = patch(specx2,specy2,[0.5,0.5,0.5]) ;
ptr = patch(specx3,specy3,[0.5,0.5,0.5]) ;
ptr = plot(W,20*log10(abs(Hd)),'k') ; set(ptr,'LineWidth',2) ;
hold off ;
axis([0.4,1.4,2,5]) ;
grid on ;
xlabel('\Omega','FontName','Times','FontSize',24) ;
ylabel('|H_{\itd}({\ite}^{{\itj}\Omega})|','FontName','Times','FontSize',24) ;
set(gca,'FontSize',18,'FontName','Times') ;
subplot(2,5,8) ;
ptr = patch(specx1,specy1,[0.5,0.5,0.5]) ;
hold on ;
ptr = patch(specx2,specy2,[0.5,0.5,0.5]) ;
ptr = patch(specx3,specy3,[0.5,0.5,0.5]) ;
ptr = plot(W,20*log10(abs(Hd)),'k') ; set(ptr,'LineWidth',2) ;
hold off ;
axis([1.3,1.9,-60,-40]) ;
grid on ;
xlabel('\Omega','FontName','Times','FontSize',24) ;
ylabel('|H_{\itd}({\ite}^{{\itj}\Omega})|','FontName','Times','FontSize',24) ;
set(gca,'FontSize',18,'FontName','Times') ;
subplot(2,5,9) ;
ptr = patch(specx1,specy1,[0.5,0.5,0.5]) ;
hold on ;
ptr = patch(specx2,specy2,[0.5,0.5,0.5]) ;
ptr = patch(specx3,specy3,[0.5,0.5,0.5]) ;
ptr = plot(W,20*log10(abs(Hd)),'k') ; set(ptr,'LineWidth',2) ;
hold off ;
axis([1.9,2.65,2,5]) ;
grid on ;
xlabel('\Omega','FontName','Times','FontSize',24) ;
ylabel('|H_{\itd}({\ite}^{{\itj}\Omega})|','FontName','Times','FontSize',24) ;
set(gca,'FontSize',18,'FontName','Times') ;
subplot(2,5,10) ;
ptr = patch(specx1,specy1,[0.5,0.5,0.5]) ;
hold on ;
ptr = patch(specx2,specy2,[0.5,0.5,0.5]) ;
ptr = patch(specx3,specy3,[0.5,0.5,0.5]) ;
ptr = plot(W,20*log10(abs(H)),'k') ; set(ptr,'LineWidth',2) ;
hold off ;
axis([2.65,pi,-50,-30]) ;
grid on ;
xlabel('\Omega','FontName','Times','FontSize',24) ;
ylabel('|H_{\itd}({\ite}^{{\itj}\Omega})|','FontName','Times','FontSize',24) ;
set(gca,'FontSize',18,'FontName','Times') ;

Trades & Technology
You might also like to view...
A heat pump receives 15 kW of heat from a cool space and uses 5 kW of power. Determine the coefficient of performance of the heat pump, and the heat delivered to the warm space.
Given: Q?C=15 kW; W?=?5 kW What will be an ideal response?
Trades & Technology
What is the required width of air space between the veneer and the backup?
What will be an ideal response?
Trades & Technology
The ____________________ Act set up the Cooperative Extension Service in 1914.
Fill in the blank(s) with the appropriate word(s).
Trades & Technology
Which HFC refrigerant has taken the place of R-12 for use in domestic refrigeration?
A. R-134a B. R-404A C. R-409A D. R-410A
Trades & Technology