%plot a Gaussian function suitable for perspective plot clear all; close all; N=51; %generate a 51 by 51 array of points x=0:(1/(N-1)):1; y=x; % x and y values between 0 and +1 spaced by % 0.02 (51 values) r = 0.2; %set the r parameter [X,Y]=meshgrid(x,y); % generate 2D grids of xy values (51 by 51 %arrays) X(i,j) = x(j) and Y(i,j) = y(i) Z=exp(-((X-0.5).^2+(Y-0.5).^2)/(2*r^2)); % generate the Gaussian function on the grid mesh(X,Y,Z) % generate the perspective plot colormap([0 0 0]); % use black only xlabel('x (ph)'), ylabel('y (ph)'); set(gca,'ydir','reverse');