function D5_time_domain
clear all
close all

x = [0,10,20,30,40,50,60,70,80, 90,100,110,120,130,140,150,160,170,180, 190, 200]
nx = length(x);
c = [1, 1,1,  1, 1, 20, 20, 1, 1, 1, 1,  1,  1, 3, 3,  1,  1,  1,  1, 1, 1]
t = [1,2,4,6,10]; nt = length(t);

sulphide_x = [45,65,65,45,45];
sulphide_z = [0,0,20,20,0];

surface_x = [0,max(x)];
surface_z = [0,0];

swamp_x = [125,145,145,125,125];
swamp_z = [0,0,2,2,0];


for ix = 1: nx
    
  x_aircraft = [x(ix)-5,x(ix)+5;]
  z_aircraft = [10,10;]
    
  for it = 1:nt
    h(it) = exp(-2*t(it)/c(ix)); 
    transient(ix,it) = -it-h(it);
    xtran(ix) = x(ix);
  end

subplot (3,2,1)
plot(t,h,'.-')
axis([0,max(t),0,h(1)])
xlabel('time (ms)')
ylabel('RX voltage')


subplot(3,1,2)
fill(sulphide_x,-sulphide_z,'c')
hold on
fill(swamp_x,-swamp_z,'c')
plot(x_aircraft,z_aircraft,'.-')
plot(x_aircraft(2),z_aircraft(2),'o')
plot(surface_x,surface_z)
hold off
axis([0,max(x),-20,20])
%xlabel('distance (m)')
ylabel('depth (m)')
  
subplot(3,1,3)
hold on
for it = 1:nt
  plot(xtran, transient(:,it),'.-')
end
axis([0,max(x),-nt-2,1])
xlabel('distance (m)')
ylabel('RX voltage')
hold off

pause(0.5);
eval(['print -djpeg100 ','input__transient',num2str(ix+100),'.jpg']);
end







end
