forked from williamBarnhart/faultResampler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake_green_meade_tri.m
73 lines (60 loc) · 1.24 KB
/
make_green_meade_tri.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
function [green,greenX,greenY,greenZ,greenok]=make_green_meade_tri(patchstruct,datastruct,plotflag)
%ss +=left-lateral
%ds +=thrust
nu = 0.25;
x = [];
y = [];
z = [];
S = [];
numfiles = length(datastruct);
Npatch = length(patchstruct);
for i=1:numfiles;
x = [x; datastruct(i).X]';
y = [y; datastruct(i).Y]';
S = [S; [datastruct(i).S]'];
end
np = length(x);
green = zeros(np,Npatch*2);
greenok = green;
if (nargout>1)
greenX=green;
greenY=green;
greenZ=green;
end
%accept z values if given
if(isfield(datastruct,'z'))
for i=1:numfiles;
z = [z; datastruct(i).Z];
end
else
z=x*0;
end
%h=waitbar(0,'Calculating Green''s Functions');
ts=0;
for j=1:2
if(j==1)
ds = 0;
ss =-1;
else
ds = -1;
ss = 0;
end
for i=1:Npatch
id = i+(j-1)*Npatch;
vx=patchstruct(i).xfault;
vy=patchstruct(i).yfault;
vz=patchstruct(i).zfault;
U = CalcTriDisps(x',y',z',vx, vy, vz, nu, ss, ts, ds);
green(:,id) = U.x.*S(:,1)+U.y.*S(:,2)-U.z.*S(:,3);
if (nargout>1)
greenX(:,id)= U.x;
greenY(:,id)= U.y;
greenZ(:,id)= -U.z;
end
end
end
if(plotflag)
figure
scatter(x,y,26,green(:,1),'filled')
axis image,colorbar
end