%  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

%  Find point position and calculate the corresponding time

%  Erase the time position

axes(sir)
hold on
plot([t1 t1],[0 1600],'w', 'LineWidth',2)

%  Get the position

axes(explanation)
hold on
plot(xt,yt,'ow', 'LineWidth',2)
[xt,yt]=ginput(1);
plot(xt,yt,'ob', 'LineWidth',2)
hold off

%  Calculate and display the time

t1=sqrt(((xt-x)/1000)^2 + (yt/1000)^2 + (z/1000)^2)/c*1e6;
set(time_text,'string',['Time: ',num2str(t1),' \mus']);

%  Plot the time position

axes(sir)
plot([t1 t1],[0 1600],'r', 'LineWidth',2)
hold off
