1 | function varargout = plotcod(RING,DP) |
---|
2 | %PLOTCOD Closed Orbit Distortion |
---|
3 | % PLOTCOD(RING,DP) finds and plots closed orbit for a given momentum |
---|
4 | % deviation DP. It calls FINDORBIT4 which assumes a lattice |
---|
5 | % with NO accelerating cavities and NO radiation |
---|
6 | % |
---|
7 | % INPUTS |
---|
8 | % 1. RING - At structure |
---|
9 | % 2. DP - Energy offset |
---|
10 | % |
---|
11 | % OUTPUTS (Optional) |
---|
12 | % 1. orbit - (x,px,y,py) closed orbit along the ring |
---|
13 | % |
---|
14 | % See Also plotbeta |
---|
15 | |
---|
16 | % Written by Andrei Terebilo |
---|
17 | % Modified by Laurent S. Nadolski |
---|
18 | % March 27, 2005 - Default input arguments added |
---|
19 | |
---|
20 | switch nargin |
---|
21 | case 0 |
---|
22 | global THERING; |
---|
23 | RING = THERING; |
---|
24 | DP = 0.0; % on mometum closed orbit |
---|
25 | case 1 |
---|
26 | DP = 0; % on momentum closed orbit |
---|
27 | otherwise |
---|
28 | %do nothing |
---|
29 | end |
---|
30 | |
---|
31 | |
---|
32 | localspos = findspos(RING,1:length(RING)+1); |
---|
33 | orbit = findorbit4(RING,DP,1:length(RING)+1); |
---|
34 | %orbit = findorbit6(RING,1:length(RING)+1); |
---|
35 | |
---|
36 | plot(localspos,orbit(1,:)*1e3,'.-r'); |
---|
37 | title('Closed Orbit Distortion') |
---|
38 | hold on |
---|
39 | plot(localspos,orbit(3,:)*1e3,'.-b'); |
---|
40 | hold off |
---|
41 | |
---|
42 | A = axis; |
---|
43 | A(1:2) = [0, localspos(end)]; |
---|
44 | axis(A); |
---|
45 | |
---|
46 | legend('Horizontal','Vertical'); |
---|
47 | xlabel('s - position [m]'); |
---|
48 | ylabel('orbit [mm]'); |
---|
49 | |
---|
50 | grid on |
---|
51 | |
---|
52 | if nargout > 0 |
---|
53 | varargout{1} = orbit; |
---|
54 | end |
---|