1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" |
---|
2 | "http://www.w3.org/TR/REC-html40/loose.dtd"> |
---|
3 | <html> |
---|
4 | <head> |
---|
5 | <title>Description of findorbit4initial</title> |
---|
6 | <meta name="keywords" content="findorbit4initial"> |
---|
7 | <meta name="description" content="FINDORBIT4 finds the closed orbit in the transverse 4-d phase"> |
---|
8 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> |
---|
9 | <meta name="generator" content="m2html © 2003 Guillaume Flandin"> |
---|
10 | <meta name="robots" content="index, follow"> |
---|
11 | <link type="text/css" rel="stylesheet" href="../m2html.css"> |
---|
12 | </head> |
---|
13 | <body> |
---|
14 | <a name="_top"></a> |
---|
15 | <div><a href="../index.html">Home</a> > <a href="index.html">at</a> > findorbit4initial.m</div> |
---|
16 | |
---|
17 | <!--<table width="100%"><tr><td align="left"><a href="../index.html"><img alt="<" border="0" src="../left.png"> Master index</a></td> |
---|
18 | <td align="right"><a href="index.html">Index for at <img alt=">" border="0" src="../right.png"></a></td></tr></table>--> |
---|
19 | |
---|
20 | <h1>findorbit4initial |
---|
21 | </h1> |
---|
22 | |
---|
23 | <h2><a name="_name"></a>PURPOSE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
24 | <div class="box"><strong>FINDORBIT4 finds the closed orbit in the transverse 4-d phase</strong></div> |
---|
25 | |
---|
26 | <h2><a name="_synopsis"></a>SYNOPSIS <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
27 | <div class="box"><strong>function orbit = FindOrbit4initial(RING,dP,orbitguess,varargin); </strong></div> |
---|
28 | |
---|
29 | <h2><a name="_description"></a>DESCRIPTION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
30 | <div class="fragment"><pre class="comment"> FINDORBIT4 finds the closed orbit in the transverse 4-d phase |
---|
31 | space by numerically solving for a fixed point of the one turn |
---|
32 | map M calculated with RingPass |
---|
33 | |
---|
34 | (X, PX, Y, PY, dP2, CT2 ) = M (X, PX, Y, PY, dP1, CT1) |
---|
35 | |
---|
36 | under the CONSTANT MOMENTUM constraint dP2 = dP1 = dP and |
---|
37 | no constraint on the 6-th coordinate CT |
---|
38 | |
---|
39 | IMPORTANT!!! FINDORBIT4initial imposes a constraint on dP and relaxes |
---|
40 | the constraint on the revolution frequency. A physical storage |
---|
41 | ring does exactly the opposite: the momentum deviation finds an |
---|
42 | equilibrium for the particle on to be synchronous with the RF cavity |
---|
43 | |
---|
44 | HarmNumber*Frev = Frf |
---|
45 | |
---|
46 | To impose this artifiacial constraint in FINDORBIT4initial |
---|
47 | Pass function used for all elements SHOULD NOT |
---|
48 | 1. change the longitudinal momentum dP (cavities , magnets with radiation) |
---|
49 | 2. have any time dependence (localized impedance, fast kickers). |
---|
50 | |
---|
51 | FINDORBIT4initial(RING,dP,orbitguess) is 4x1 vector - fixed point at the |
---|
52 | entrance of the 1-st element of the RING (x,px,y,py) |
---|
53 | |
---|
54 | FINDORBIT4initial(RING,dP,orbitguess,REFPTS) is 4-by-Length(REFPTS) |
---|
55 | array of coloumn vectors - fixed points (x,px,y,py) |
---|
56 | at the entrance of each element indexed REFPTS array. |
---|
57 | REFPTS is an array of increasing indexes that select elements |
---|
58 | from the range 1 to length(RING)+1. |
---|
59 | See further explanation of REFPTS in the 'help' for FINDSPOS |
---|
60 | |
---|
61 | See also: FindOrbit6, FindSyncOrbit</pre></div> |
---|
62 | |
---|
63 | <!-- crossreference --> |
---|
64 | <h2><a name="_cross"></a>CROSS-REFERENCE INFORMATION <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
65 | This function calls: |
---|
66 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
67 | </ul> |
---|
68 | This function is called by: |
---|
69 | <ul style="list-style-image:url(../matlabicon.gif)"> |
---|
70 | </ul> |
---|
71 | <!-- crossreference --> |
---|
72 | |
---|
73 | |
---|
74 | <h2><a name="_source"></a>SOURCE CODE <a href="#_top"><img alt="^" border="0" src="../up.png"></a></h2> |
---|
75 | <div class="fragment"><pre>0001 <a name="_sub0" href="#_subfunctions" class="code">function orbit = FindOrbit4initial(RING,dP,orbitguess,varargin);</a> |
---|
76 | 0002 <span class="comment">% FINDORBIT4 finds the closed orbit in the transverse 4-d phase</span> |
---|
77 | 0003 <span class="comment">% space by numerically solving for a fixed point of the one turn</span> |
---|
78 | 0004 <span class="comment">% map M calculated with RingPass</span> |
---|
79 | 0005 <span class="comment">%</span> |
---|
80 | 0006 <span class="comment">% (X, PX, Y, PY, dP2, CT2 ) = M (X, PX, Y, PY, dP1, CT1)</span> |
---|
81 | 0007 <span class="comment">%</span> |
---|
82 | 0008 <span class="comment">% under the CONSTANT MOMENTUM constraint dP2 = dP1 = dP and</span> |
---|
83 | 0009 <span class="comment">% no constraint on the 6-th coordinate CT</span> |
---|
84 | 0010 <span class="comment">%</span> |
---|
85 | 0011 <span class="comment">% IMPORTANT!!! FINDORBIT4initial imposes a constraint on dP and relaxes</span> |
---|
86 | 0012 <span class="comment">% the constraint on the revolution frequency. A physical storage</span> |
---|
87 | 0013 <span class="comment">% ring does exactly the opposite: the momentum deviation finds an</span> |
---|
88 | 0014 <span class="comment">% equilibrium for the particle on to be synchronous with the RF cavity</span> |
---|
89 | 0015 <span class="comment">%</span> |
---|
90 | 0016 <span class="comment">% HarmNumber*Frev = Frf</span> |
---|
91 | 0017 <span class="comment">%</span> |
---|
92 | 0018 <span class="comment">% To impose this artifiacial constraint in FINDORBIT4initial</span> |
---|
93 | 0019 <span class="comment">% Pass function used for all elements SHOULD NOT</span> |
---|
94 | 0020 <span class="comment">% 1. change the longitudinal momentum dP (cavities , magnets with radiation)</span> |
---|
95 | 0021 <span class="comment">% 2. have any time dependence (localized impedance, fast kickers).</span> |
---|
96 | 0022 <span class="comment">%</span> |
---|
97 | 0023 <span class="comment">% FINDORBIT4initial(RING,dP,orbitguess) is 4x1 vector - fixed point at the</span> |
---|
98 | 0024 <span class="comment">% entrance of the 1-st element of the RING (x,px,y,py)</span> |
---|
99 | 0025 <span class="comment">%</span> |
---|
100 | 0026 <span class="comment">% FINDORBIT4initial(RING,dP,orbitguess,REFPTS) is 4-by-Length(REFPTS)</span> |
---|
101 | 0027 <span class="comment">% array of coloumn vectors - fixed points (x,px,y,py)</span> |
---|
102 | 0028 <span class="comment">% at the entrance of each element indexed REFPTS array.</span> |
---|
103 | 0029 <span class="comment">% REFPTS is an array of increasing indexes that select elements</span> |
---|
104 | 0030 <span class="comment">% from the range 1 to length(RING)+1.</span> |
---|
105 | 0031 <span class="comment">% See further explanation of REFPTS in the 'help' for FINDSPOS</span> |
---|
106 | 0032 <span class="comment">%</span> |
---|
107 | 0033 <span class="comment">% See also: FindOrbit6, FindSyncOrbit</span> |
---|
108 | 0034 |
---|
109 | 0035 <span class="keyword">if</span> ~iscell(RING) |
---|
110 | 0036 error(<span class="string">'First argument must be a cell array'</span>); |
---|
111 | 0037 <span class="keyword">end</span> |
---|
112 | 0038 |
---|
113 | 0039 <span class="keyword">if</span> ~(isreal(dP) & length(dP)==1) |
---|
114 | 0040 error(<span class="string">'Second argument must be a scalar'</span>); |
---|
115 | 0041 <span class="keyword">end</span> |
---|
116 | 0042 |
---|
117 | 0043 <span class="keyword">if</span> ~(isreal(orbitguess) & length(orbitguess)==6) |
---|
118 | 0044 error(<span class="string">'Third argument must be a 6x1 matrix'</span>); |
---|
119 | 0045 <span class="keyword">end</span> |
---|
120 | 0046 |
---|
121 | 0047 |
---|
122 | 0048 <span class="comment">%d = sqrt(eps); % step size for numerical differentiation</span> |
---|
123 | 0049 d = 1e-10; |
---|
124 | 0050 max_iterations = 20; |
---|
125 | 0051 J = zeros(4); |
---|
126 | 0052 Ri = orbitguess; |
---|
127 | 0053 Ri(5) = dP; |
---|
128 | 0054 |
---|
129 | 0055 change = 1; |
---|
130 | 0056 itercount = 0; |
---|
131 | 0057 <span class="keyword">while</span> (change>eps) & (itercount < max_iterations) |
---|
132 | 0058 RMATi=[Ri Ri Ri Ri Ri]; |
---|
133 | 0059 <span class="keyword">for</span> k = 1:4 |
---|
134 | 0060 RMATi(k,k)=RMATi(k,k)+d; |
---|
135 | 0061 <span class="keyword">end</span> |
---|
136 | 0062 RMATf = ringpass(RING,RMATi); |
---|
137 | 0063 Rf = RMATf(:,5); |
---|
138 | 0064 <span class="comment">% compute the transverse part of the Jacobian</span> |
---|
139 | 0065 |
---|
140 | 0066 J = (RMATf(1:4,1:4) - [Rf(1:4) Rf(1:4) Rf(1:4) Rf(1:4)])/d; |
---|
141 | 0067 B = inv(J-diag(ones(1,4))); |
---|
142 | 0068 B(5,5)=1; |
---|
143 | 0069 B(6,6)=0; |
---|
144 | 0070 Ri_next = Ri - B*(Rf-Ri); |
---|
145 | 0071 change = norm(Ri_next - Ri); |
---|
146 | 0072 Ri = Ri_next; |
---|
147 | 0073 itercount = itercount+1; |
---|
148 | 0074 <span class="keyword">end</span>; |
---|
149 | 0075 |
---|
150 | 0076 <span class="keyword">if</span>(nargin<4) <span class="comment">% return only the fixed point at the entrance of RING{1}</span> |
---|
151 | 0077 orbit=Ri(1:4,1); |
---|
152 | 0078 <span class="keyword">else</span> <span class="comment">% 3-rd input argument - vector of reference points alog the Ring</span> |
---|
153 | 0079 <span class="comment">% is supplied - return orbit</span> |
---|
154 | 0080 orb6 = linepass(RING,Ri,varargin{1}); |
---|
155 | 0081 orbit = orb6(1:4,:); |
---|
156 | 0082 <span class="keyword">end</span></pre></div> |
---|
157 | <hr><address>Generated on Fri 18-May-2007 17:13:39 by <strong><a href="http://www.artefact.tk/software/matlab/m2html/">m2html</a></strong> © 2003</address> |
---|
158 | </body> |
---|
159 | </html> |
---|