%Chapter 2, Fig. 2.6 (c) %Eric Dubois, updated 2018-11-08 %Perspective plot of Gaussian function %the image is square 1ph x 1ph sampled at 51 x 51 % the parameter of the Gaussian is r = 0.2 ph clear all, close all %generate the Gaussian image L1=0; L2=1; del = (L2-L1)/50; x=L1:del:L2; y=x; %x and y values between 0 and +1 spaced by del r0 = 0.2; [X,Y]=meshgrid(x,y); % generate a 2D grid of xy values Z=exp(-((X-0.5).^2+(Y-0.5).^2)/(2*r0^2)); % generate the Gaussian function on the grid figure mesh(X,Y,Z) % generate the perspective plot colormap([0 0 0]); % use black only xlabel('\itx \rm(ph)'), ylabel('\ity \rm(ph)'); set(gca,'ydir','reverse'); set(gca,'FontName','times') %set the plot font to Times set(gca,'FontSize',8) %set the plot size to 8pt set(gcf,'units','centimeters','position',[0.5,0.5,15,15]); set(gcf,'Color',[1 1 1]);