source: MML/trunk/at/atphysics/findelemm44.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 10 years ago

Initial import--MML version from SOLEIL@2013

File size: 1003 bytes
Line 
1function M44 = findelemm44(ELEM, MethodName, orbit_in)
2%FINDELEMM44 numerically finds the 4x4 transfer matrix of an element
3%  FINDELEM44(ELEM, METHODNAME, ORBITIN)
4%     ELEM          - the element data structure
5%     METHODNAME    - name of the pass-method function
6%     ORBITIN       - 6-by-1 phase space coordinates at the entrance
7%                     The transvese matrix is momentum-dependent,
8%                     the 5-th component of ORBITIN is used as the DP value
9%
10% See also FINDELEMM66
11
12% See if step size for numerical differentiation
13% is set globally. Otherwise use 1e-7
14global NUMDIFPARAMS
15% Transverse
16if isfield(NUMDIFPARAMS,'XYStep')
17    dt = NUMDIFPARAMS.XYStep';
18else
19    dt =  1e-7;
20end
21
22
23% Build a diagonal matrix of initial conditions
24D4 = [dt*eye(4);zeros(2,4)];
25% Add to the orbit_in
26
27RIN = orbit_in*ones(1,8) + [D4, -D4];
28% Propagate through the element
29ROUT = feval(MethodName,ELEM,RIN);
30% Calculate numerical derivative
31M44 = [(ROUT(1:4,1:4)-ROUT(1:4,5:8))./(2*dt)];
Note: See TracBrowser for help on using the repository browser.