-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshowRefractedWave.m
55 lines (48 loc) · 1.02 KB
/
showRefractedWave.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
function [x,t]=showRefractedWave(V1,spacing,h,V2)
% [x,t]=showRefractedWave(V1,spacing)
%
% Plots the arrival times for a refracted wave
%
% INPUT:
%
% V1 wave velocity
% spacing spacing between the electrodes
% h depth to refracting layer
% V2 velocity of refracting layer
%
% OUTPUT:
%
% x geophone locations
% t travel times
%
% Last modified by plattner-at-alumni.ethz.ch, 11/3/2015
xoneside=0:spacing:spacing*12;
if V2>V1
% Critical Distance
xcrit = 2*h/sqrt( (V2/V1)^2-1 );
% Only show the points further away from the source than the critical distance
minindex=min(find(xoneside>xcrit));
x=xoneside(minindex:end);
x=[-x x];
x=sort(x);
t=2*h*sqrt(V2^2-V1^2)/(V1*V2) + abs(x)/V2;
else
disp('No refracted wave')
x=[];
t=[];
end
if ~isempty(x)
fs=12;
hold on
plot(x,t,'o')
set(gca,'FontSize',fs)
set(gca,'XAxisLocation','Top')
xlim([min(x) max(x)]);
ylims=get(gca,'YLim');
ylim([0 max(max(t),max(ylims))]);
axis ij
ylabel('Time [s]')
xlabel('Distance from shot [m]')
grid on
%grid minor
end