close all
clear all

Q = [50:50:200];  %L/min
q = Q*.001/60;  %m^3/s

D = [.1:.1:2.5];




for k = 1:length(q)
N = 100;
for j = 1:length(D)
  z0 = D(j)/2;
  z(:,j) = -z0+z0/N:z0/N:z0-z0/N;
  phi(:,j) = q(k)*(((z0-z(:,j)).^2).^.5-((z0+z(:,j)).^2).^.5)/(4*pi);
  w(:,j) = q(k)*(((z0-z(:,j)).^-2)+((z0+z(:,j)).^-2))/(4*pi);

hold all
Time(k,j) = trapz(z(:,j),1./w(:,j));
end
leg_str{k} = (['Flow Rate = ' num2str(Q(k)) ' L/min']);
end

figure('Position',[ 1000         530         794         968]);
plot(D,Time/60)
xlabel('Distance Between Source and Sink (m)');
ylabel('Minimum Travel Time (minutes)');
legend(leg_str,'Location','NorthWest');
ylim([0 60]);
grid on
print('-dpdf','MinimumTravelTime.pdf')
