% Chapter 10, Fig. 10.14 %Eric Dubois, updated 2018-12-20 % Ideal lowpass response with polygonal boundary for example in the intro to % the section on the frequency-domain design of multidimensional FIR % filters %Required functions: ideal_response_qs clear all;close all; %Generate ideal filter response Npt=512; %With large number of points for the contour plot of the boundary Hd = ideal_response_qs('polygonal_specs_example.txt',Npt); [f1,f2] = freqspace(Npt); [F1,F2] = meshgrid(.5*f1,.5*f2); %contour plot of band edges figure; v=[0.001,0.999]; % contours will be at 0 and 1, essentially. [C,h1]=contour(F1,F2,abs(Hd),v); % generate the contour plot, including values to label contours axis square xlabel('u (c/px)'), ylabel('v (c/px)'); text(.1,.1,'1'); text(.22,.22,'0'); set(gca,'ydir','reverse'); set(gca,'fontname','times') %set the plot font to Times colormap([0 0 0]); % use black only set(gcf,'Color',[1 1 1]); % perspective view of the ideal response %subsample the response to get a suitable plot figure; mesh(F1(1:16:Npt,1:16:Npt),F2(1:16:Npt,1:16:Npt),abs(Hd(1:16:Npt,1:16:Npt))); % generate the perspective plot axis([-.5, .5, -.5, .5, 0, 1]); colormap([0 0 0]); % use black only xlabel('u (c/px)'), ylabel('v (c/px)'); set(gca,'ydir','reverse'); set(gca,'fontname','times') %set the plot font to Times set(gcf,'Color',[1 1 1]);