forked from pieropoli/Seismic_Matlab_Functions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSiteAmplification.m
58 lines (54 loc) · 2.14 KB
/
SiteAmplification.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
56
57
58
function [ampFactor] = SiteAmplification(depth, velocity, ...
density, velocityReceiver, densityReceiver, f)
% SiteAmplification.m
% -----------------------------------------------------------
% Usage: [ampFactor] = SiteAmplification(depth, velocity, ...
% density, velocityReceiver, densityReceiver, f)
% -----------------------------------------------------------
% This function calculates the amplification originated close to the station
% due to the geology in the las meters under the receiver.
% Input:
% Velocity model: depth, velocity, density. They are vectors of the same
% size.
% velocityReceiver, densityReceiver. Velocity and density in the surrounding
% area of the receiver.
%
n = length(depth);
travelTime = zeros(size(depth));
slope = zeros(size(depth));
thickness = zeros(size(depth));
avgDensity = ones(size(depth));
for i = 2 : n
if velocity(i) == velocity(i - 1) % Constant velocity
slope(i) = 0;
travelTime(i) = travelTime(i - 1) + (depth(i) - depth(i - 1)) / velocity(i);
else
if depth(i) == depth(i - 1) % Step change
slope(i) = 1e10;
travelTime(i) = travelTime(i - 1);
else
slope(i) = (velocity(i) - velocity(i-1)) / (depth(i) - depth(i-1));
travelTime(i) = travelTime(i-1) + (1 / slope(i)) * ...
log(velocity(i) / velocity(i-1));
end
end
avgDensity(i) = 1 / travelTime(i) * (travelTime(i-1) * avgDensity(i-1) + ...
(travelTime(i) - travelTime(i-1)) * ...
(density(i) + density(i-1)) / 2);
thickness(i) = depth(i) - depth(i-1);
velocityLayer(i) = thickness(i) / (travelTime(i) - travelTime(i-1));
densityLayer(i) = (density(i) + density(i)) / 2;
avgVelocity(i) = depth(i) / travelTime(i);
freq(i) = 1 / (4 * travelTime(i));
amplification(i) = sqrt((densityReceiver * velocityReceiver) / ...
(avgDensity(i) * avgVelocity(i)));
end
if depth(1) == 0
freq = freq(2:end);
amplification = amplification(2:end);
end
% loglog(freq, amplification)
%
f = f(find(f(:,1)~=0),:);
ampFactor = 10 .^ interp1(log10(freq(find(freq~=0))), log10(amplification(find(freq~=0))), log10(f), ...
'linear', 'extrap');