
clear
clf

s=peaks;
s=s.*s;
s=s/max(max(s));

xlabel(' x ')
ylabel(' y ')
zlabel(' p(x,y) ')
[nx ny]=size(s);

x=1:nx;
y=1:ny;

sx=s(:,ny/2);
sy=s(nx/2,:);

%sx=sx/max(sx);
%sy=sy/max(sy);

surf(s),shading interp, 
xlabel(' x ')
ylabel(' y ')
zlabel(' p(x,y) ')
axis([ 0 50 0 50 0 1]);

hold on

plot3(x,y*0+25,sy,'r-','LineWidth',3)
plot3(x,y*0+50,sy,'r-','LineWidth',3)
plot3(x*0+25,y,sx,'r-','LineWidth',3)
plot3(x*0+50,y,sx,'r-','LineWidth',3)