-
Notifications
You must be signed in to change notification settings - Fork 0
/
trajectory.m
59 lines (50 loc) · 1.37 KB
/
trajectory.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
clear
clf
numOfPositron = 20;
annihilateThreshold = 0.3;
vInitial = 5;
isTrack = 1;
t = tiledlayout(4, 4);
k = 0;
for scatterThreshold = 0:0.3333:1
for magneticField = [0, 100, 500, 900]
tic;
record = PMRMC(numOfPositron, magneticField, ...
annihilateThreshold, scatterThreshold, vInitial, isTrack);
k = k + 1;
eval(['t',num2str(k), ' = nexttile;']);
oneplot(record)
dur = toc;
disp(['scatter: ' num2str(scatterThreshold) ...
', magnetic field: ' num2str(magneticField), ...
', time consumed: ' num2str(dur) ' s.'])
end
end
t.TileSpacing = 'none';
t.Padding = 'none';
export_fig('trajectory.png')
function [] = oneplot(rec)
for ii = 1:length(rec)
plot3(rec{ii}(:,1),rec{ii}(:,2),rec{ii}(:,3), 'LineWidth', 1)
hold on
scatter_site = scatterSort(rec{ii});
scatter3(scatter_site(:,1), scatter_site(:,2), scatter_site(:,3), ...
'x', 'SizeData', 8)
annihi_site = rec{ii}(end,:);
scatter3(annihi_site(1), annihi_site(2), annihi_site(3), ...
'o', 'filled', 'SizeData', 12)
axis equal,
grid off
axis off
end
end
function scat_coord = scatterSort(record)
scatter_list = record(:,7);
if max(scatter_list) == 0
scat_coord = [0, 0, 0];
else
[~,ind] = unique(scatter_list, 'first');
scat_coord = record(ind,:);
end
scat_coord(1,:) = [];
end