-
Notifications
You must be signed in to change notification settings - Fork 0
/
topo_660.m
125 lines (93 loc) · 2.68 KB
/
topo_660.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
gauss_topo=10;
fs_topo=100;
ln_topo=1001;
gauss_mean=gauss_topo/2+0;
gauss_sigma=gauss_topo/6;
[ti_topo,wf_topo,fs_topo]=gen_wf(gauss_mean,gauss_sigma,fs_topo,ln_topo);
wf_topo=660+30*wf_topo;
dis=ti_topo(1:10:end);
topo=wf_topo(1:10:end);
mean_topo=mean(topo);
gauss=6;
fs=4;
ln=4096;
t_range=[-200,600];
gauss_mean=gauss_topo/2+50;
gauss_sigma=gauss_topo/6;
[ti,wf,fs]=gen_wf(gauss_mean,gauss_sigma,fs,ln);
refd=800;
min_thick=5;
ddeg=110;
p=raypar_r(deg2rayp(ddeg,'P^660P'),0);
n_order=4;
min_period=15; % s
max_period=75; % s
[b,a]=butter(n_order,[1/max_period 1/min_period]/(fs/2),'bandpass'); % parameters for filter
%%
figure;hold on;
plot(ti_topo,wf_topo);
plot(dis,topo,'ko');
plot([0,10],mean_topo*ones(1,2),'r');
hold off;
xlabel('Distance (degree)');
ylabel('Depth (km)');
title('Topography');
view([0 -90]);
topo_x=[topo,mean_topo];
num_topo=length(topo_x);
wfcell=cell(num_topo,3);
%%
for i_topo=1:num_topo
% load prem
load('../earth_model/prem_uneft.mat'); % for prem
prem(22:23,1)=topo_x(i_topo)*ones(2,1);
prem_cut=cut_model(prem,0,refd);
prem_eft=eft(prem_cut);
prem_cake_eft=gen_cake(prem_eft,min_thick);
em=prem_cake_eft;
% generate input waveform
[pp_t,pp_wf]=ppwf_fast(em,p,wf,fs);
ppwf_fil=filter(b,a,pp_wf);
%shift
[~,ind_t]=max(ppwf_fil);
t_p=pp_t-pp_t(ind_t);
[tpp,wfpp]=shift_pp(t_p,ppwf_fil,0,t_range);
wfcell{i_topo,1}=tpp;
wfcell{i_topo,2}=pp_wf;
wfcell{i_topo,3}=wfpp;
end
wf_stack=sum(cell2mat(wfcell(1:end-1,3)))./(size(wfcell,1)-1);
%%
tind=-30;
ind_t=find(tpp==tind);
figure;hold on;
for i_topo=1:num_topo-1
plot(wfcell{i_topo,1}(1:ind_t),wfcell{i_topo,3}(1:ind_t)*20+i_topo*1,'k');
plot(wfcell{i_topo,1}(ind_t:end),wfcell{i_topo,3}(ind_t:end)*2+i_topo*1,'k');
end
plot(tpp(1:ind_t),wf_stack(1:ind_t)*20+12*1,'k');
plot(tpp(ind_t:end),wf_stack(ind_t:end)*2+12*1,'k');
plot(wfcell{end,1}(1:ind_t),wfcell{end,3}(1:ind_t)*20+12*1,'r');
plot(wfcell{end,1}(ind_t:end),wfcell{end,3}(ind_t:end)*2+12*1,'r');
ylim=get(gca,'YLim');
plot([tind,tind],ylim,'k--');
xlim([-210,30]);
xlabel('Time (s)');
ylabel('');
%%
tind=-30;
ind_t=find(tpp==tind);
figure;hold on;
for i_topo=1:num_topo-1
plot(wfcell{i_topo,1}(1:ind_t),wfcell{i_topo,3}(1:ind_t)*20,'color',[0.5,0.5,0.5]);
plot(wfcell{i_topo,1}(ind_t:end),wfcell{i_topo,3}(ind_t:end)*2,'color',[0.5,0.5,0.5]);
end
plot(tpp(1:ind_t),wf_stack(1:ind_t)*20,'k');
plot(tpp(ind_t:end),wf_stack(ind_t:end)*2,'k');
plot(wfcell{end,1}(1:ind_t),wfcell{end,3}(1:ind_t)*20,'r');
plot(wfcell{end,1}(ind_t:end),wfcell{end,3}(ind_t:end)*2,'r');
ylim=get(gca,'YLim');
plot([tind,tind],ylim,'k--');
xlim([-210,30]);
xlabel('Time (s)');
ylabel('');