-
Notifications
You must be signed in to change notification settings - Fork 9
/
a5_b_remove_radiation_pattern.m
50 lines (40 loc) · 1.42 KB
/
a5_b_remove_radiation_pattern.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
% Remove radiation pattern
% Radiation pattern is calculated and saved in a3_attach_excitation.m
%
% A_corr = A / A_radiation
clear
% setup parameters
setup_parameters
workingdir = parameters.workingdir;
receiverterms_path = [workingdir];
% input path
eventcs_path = [workingdir,'CSmeasure/'];
comp = parameters.component;
periods = parameters.periods;
csmatfiles = dir([eventcs_path,'/*cs_',comp,'.mat']);
for ie = 1:length(csmatfiles)
%for ie = 30
clear ampgrad
% read in data and set up useful variables
temp = load([eventcs_path,csmatfiles(ie).name]);
eventcs = temp.eventcs;
disp(eventcs.id)
% Loop through the periods
for ip = 1:length(periods)
% Divide amplitude data by |sind(delta)|^-0.5 to remove geometrical spreading
for ista = 1:length(eventcs.autocor)
% Get radiation pattern info
mode = 0; % 0 = fundamental mode; 1 = first overtone, etc...
AmpFactor = eventcs.source(ista).excitation(ip).ratio_AmpMax(mode+1);
if eventcs.autocor(ista).exitflag(ip)>0
amps(ista) = eventcs.autocor(ista).amp(ip);
else
amps(ista) = NaN;
end
% A_corr^2 = A^2 / Amp_radiation^2
amp_corr = eventcs.autocor(ista).amp(ip) / AmpFactor.^2;
eventcs.autocor(ista).amp(ip) = amp_corr;
end
end
save([eventcs_path,csmatfiles(ie).name],'eventcs');
end % end of loop ie