function ampplot2(h,FFT_N)
% AMPPLOT2  ampplot2(h,FFT_N)
%	Make a 2D amplitude response surface-plot with resolution given
%	by FFT_N.

[M,N]=size(h);

% Generate a frequency variable
f=((0:FFT_N-1)/(FFT_N-1)-0.5)*2*pi;

% Make the plot
H=abs(fftshift(fft2([h zeros(M,FFT_N-N);zeros(FFT_N-M,FFT_N)])));
surf(f,f,H); 

minA=-pi-0.2;
maxA= pi+0.2;
minH=min(min(H));
maxH=max(max(H));

% Draw the axis
axis([minA maxA minA maxA minH maxH]);
axis('off');
lh(1)=line([-pi  pi],[-pi -pi],[minH minH]);
lh(2)=line([-pi -pi],[-pi  pi],[minH minH]);
lh(3)=line([-pi -pi],[ pi  pi],[minH maxH]);

% Draw the tick marks
lh(4) =line([-pi     -pi    ],[-pi-0.2 -pi+0.2],[minH minH]);
lh(5) =line([  0      0     ],[-pi-0.2 -pi+0.2],[minH minH]);
lh(6) =line([ pi      pi    ],[-pi-0.2 -pi+0.2],[minH minH]);
lh(7) =line([-pi-0.2 -pi+0.2],[-pi     -pi    ],[minH minH]);
lh(8) =line([-pi-0.2 -pi+0.2],[  0      0     ],[minH minH]);
lh(9) =line([-pi-0.2 -pi+0.2],[ pi      pi    ],[minH minH]);
lh(10)=line([-pi-0.2 -pi+0.2],[ pi      pi    ],[maxH maxH]);
for i=1:length(lh)
  set(lh(i),'Color','White');
end

text(-pi    ,-pi-0.4,0,'-\pi','HorizontalAlignment','left','FontSize',8)
text( pi    ,-pi-0.4,0,'\pi','HorizontalAlignment','left','FontSize',8)
text(-pi-0.4,-pi    ,0,'-\pi','HorizontalAlignment','right','FontSize',8)
text(-pi-0.4, pi    ,0,'\pi','HorizontalAlignment','right','FontSize',8)
text(-pi-0.4, pi    ,maxH,sprintf('%3.1f',maxH),...
  'HorizontalAlignment','right','FontSize',8);

% Place the axis labels (Matlab 4.2)
% mergtex([ntex('+ ') gtex('p')],'xps=0.870','yps=0.220','siz=18');
% mergtex([ntex('0')           ],'xps=0.685','yps=0.150','siz=18');
% mergtex([ntex('- ') gtex('p')],'xps=0.480','yps=0.090','siz=18');
% mergtex([ntex('- ') gtex('p')],'xps=0.380','yps=0.100','siz=18');
% mergtex([ntex('0')           ],'xps=0.260','yps=0.179','siz=18');
% mergtex([ntex('+ ') gtex('p')],'xps=0.100','yps=0.265','siz=18');
