1 | %% |
---|
2 | |
---|
3 | Threshold = 1.5e7; |
---|
4 | |
---|
5 | [ir ic] = find(AM.Data.Sum > Threshold); |
---|
6 | |
---|
7 | irfirst = []; |
---|
8 | icfirst = []; |
---|
9 | for k=1:120, |
---|
10 | val = min(find(ir==k)); |
---|
11 | if isempty(val) |
---|
12 | fprintf('BPM number %d with no data\n', k); |
---|
13 | else |
---|
14 | irfirst(k) = ir(val) ; |
---|
15 | icfirst(k) = ic(val) ; |
---|
16 | end |
---|
17 | end |
---|
18 | |
---|
19 | figure |
---|
20 | plot(ir,ic,'.'); hold on; |
---|
21 | plot(irfirst,icfirst,'xr'); hold off |
---|
22 | grid on |
---|
23 | xlabel('BPM number') |
---|
24 | ylabel('Turn number above Threshold'); |
---|
25 | title(sprintf('Threshold is %e',Threshold)); |
---|
26 | |
---|
27 | %% |
---|
28 | figure |
---|
29 | h1 = subplot(7,1,[1 3]); |
---|
30 | plot(spos, AM.Data.X(sub2ind(size(AM.Data.X),irfirst,icfirst)),'Color',nxtcolor) |
---|
31 | hold on |
---|
32 | |
---|
33 | nturn = 10; |
---|
34 | for k=2:nturn, |
---|
35 | plot(spos, AM.Data.X(sub2ind(size(AM.Data.X),irfirst,icfirst+k)),'Color',nxtcolor) |
---|
36 | end |
---|
37 | ylabel('X (mm)') |
---|
38 | |
---|
39 | h2 = subplot(7,1,[5 7]); |
---|
40 | plot(spos, AM.Data.Z(sub2ind(size(AM.Data.Z),irfirst,icfirst)),'Color',nxtcolor) |
---|
41 | hold on |
---|
42 | |
---|
43 | for k=2:nturn, |
---|
44 | plot(spos, AM.Data.Z(sub2ind(size(AM.Data.Z),irfirst,icfirst+k)),'Color',nxtcolor) |
---|
45 | end |
---|
46 | |
---|
47 | str = eval(['{', sprintf('''Turn # %d'',',(1:nturn)), '}']); |
---|
48 | |
---|
49 | legend(str,'Position',[0.915 0.4514 0.08195 0.1244]) |
---|
50 | xlabel('s (m)') |
---|
51 | ylabel('Z (mm)') |
---|
52 | |
---|
53 | h3 = subplot(7,1,4); |
---|
54 | drawlattice; |
---|
55 | |
---|
56 | linkaxes([h1,h2,h3],'x'); |
---|
57 | set([h1,h2,h3],'Xgrid','On', 'Ygrid','On'); |
---|
58 | addlabel(1,0,datestr(AM.TimeStamp,21)); |
---|