Home > atphysics > LinearOptics > findelemm66.m

findelemm66

PURPOSE ^

FINDELEMM66 numerically finds the 6x6 transfer matrix of an element

SYNOPSIS ^

function M66 = findelemm66(ELEM, MethodName, R0)

DESCRIPTION ^

FINDELEMM66 numerically finds the 6x6 transfer matrix of an element
  FINDELEM66(ELEM, METHODNAME, ORBITIN)
     ELEM          - the element data structure
     METHODNAME    - name of the pass-method function
                   (default:  ELEM.PassMethod)
     ORBITIN       - 6-by-1 phase space coordinates at the entrance
                   (default: zeros(6,1))
 
 See also FINDELEMM44

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function M66 = findelemm66(ELEM, MethodName, R0)
0002 %FINDELEMM66 numerically finds the 6x6 transfer matrix of an element
0003 %  FINDELEM66(ELEM, METHODNAME, ORBITIN)
0004 %     ELEM          - the element data structure
0005 %     METHODNAME    - name of the pass-method function
0006 %                   (default:  ELEM.PassMethod)
0007 %     ORBITIN       - 6-by-1 phase space coordinates at the entrance
0008 %                   (default: zeros(6,1))
0009 %
0010 % See also FINDELEMM44
0011 
0012 if (nargin < 3) || isempty(R0),  R0 = zeros(6,1); end
0013 if (nargin < 2) || isempty(MethodName),  MethodName=ELEM.PassMethod; end
0014 
0015 % Determine step size to use for numerical differentiation
0016 global NUMDIFPARAMS
0017 % Transverse
0018 if isfield(NUMDIFPARAMS,'XYStep')
0019     dt = NUMDIFPARAMS.XYStep';
0020 else
0021     % optimal differentiation step - Numerical Recipes
0022     dt =  6.055454452393343e-006;
0023 end
0024 % Longitudinal
0025 if isfield(NUMDIFPARAMS,'DPStep')
0026     dl = NUMDIFPARAMS.DPStep';
0027 else
0028     % optimal differentiation step - Numerical Recipes
0029     dl =  6.055454452393343e-006;
0030 end
0031 
0032 % Build a diagonal matrix of initial conditions
0033 D6 = [0.5*dt*eye(4),zeros(4,2);zeros(2,4),0.5*dl*eye(2)];
0034 % Add to the orbit_in
0035 RIN = R0(:,ones(1,12)) + [D6, -D6];
0036 % Propagate through the element
0037 ROUT = feval(MethodName,ELEM,RIN);
0038 % Calculate numerical derivative
0039 M66 = [(ROUT(:,1:4)-ROUT(:,7:10))./dt, (ROUT(:,5:6)-ROUT(:,11:12))./dl];

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005