%  Demonstration of spatial impulse response for a
%  rectangular aperture using Field II
%
%  Version 1, July 3, 1999, Joergen Arendt Jensen
%  Version 3, September 13, 2018, Joergen Arendt Jensen
%     New font sizes and linewidths added

%  Plot the explanation for the field point position

%  Find the circles and plot them

tmin=t;
tmax=(length(h)-1)/fs+t;
dt=(tmax-tmin)/10.0;
r=abs(sqrt(((tmin:dt:tmax)*c).^2-(z/1000)^2)*1000);
theta=(0:360)/180*pi;

%  Plot the circles

axes(explanation)
plot([-width/2 width/2 width/2 -width/2 -width/2]*1000,[-height/2 -height/2 height/2 height/2 -height/2]*1000, 'LineWidth',2)
hold on
for i=1:length(r)
  plot(r(i)*cos(theta)+x,r(i)*sin(theta),'r--', 'LineWidth',1)
  end
plot([-width/2 width/2 width/2 -width/2 -width/2]*1000,[-height/2 -height/2 height/2 height/2 -height/2]*1000, 'LineWidth',2)
hold off
xlabel('x [mm]')
ylabel('y [mm]')
axis('image')
grid
title('Spherical wave projections')
zoom on
time_text = text (0.2, -0.2,['Time: ',num2str(0),' \mus'],...
                  'Units','normalized','HorizontalAlignment','left',...
                  'FontSize',16);

