%  Demonstration of spatial impulse response for a
%  rectangular aperture using Field II
%
%  Version 1, July 3, 1999, Joergen Arendt Jensen
%
%  Find point position and calculate the corresponding time

%  Erase the time position

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

%  Get the position

axes(explanation)
hold on
plot(xt,yt,'ow')
[xt,yt]=ginput(1);
plot(xt,yt,'ob')
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')
hold off
