source: MML/trunk/at/atphysics/findelemm66.m @ 5

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

Initial import--MML version from SOLEIL@2013

File size: 1022 bytes
Line 
1function M66 = findelemm66(ELEM, MethodName, orbit_in);
2%FINDELEMM66 numerically finds the 6x6 transfer matrix of an element
3%  FINDELEM66(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%
8% See also FINDELEMM44
9
10% See if step size for numerical differentiation
11% is set globally. Otherwise use 1e-7
12global NUMDIFPARAMS
13% Transverse
14if isfield(NUMDIFPARAMS,'XYStep')
15    dt = NUMDIFPARAMS.XYStep';
16else
17    dt =  1e-7;
18end
19% Longitudinal
20if isfield(NUMDIFPARAMS,'DPStep')
21    dl = NUMDIFPARAMS.DPStep';
22else
23    dl =  1e-7;
24end
25
26% Build a diagonal matrix of initial conditions
27D6 = [dt*eye(4),zeros(4,2);zeros(2,4), dl*eye(2)];
28% Add to the orbit_in
29RIN = orbit_in*ones(1,12) + [D6, -D6];
30% Propagate through the element
31ROUT = feval(MethodName,ELEM,RIN);
32% Calculate numerical derivative
33M66 = [(ROUT(:,1:4)-ROUT(:,7:10))./(2*dt), (ROUT(:,5:6)-ROUT(:,11:12))./(2*dl)];
Note: See TracBrowser for help on using the repository browser.