Home > lattice > settilt.m

settilt

PURPOSE ^

SETTILT sets the entrance and exit misalignment matrixes

SYNOPSIS ^

function settilt(ELEMINDEX, PSI)

DESCRIPTION ^

SETTILT sets the entrance and exit misalignment matrixes
 of an element or a group of elements in THERING
 Previously stored values are overwritten.

 SETTILT(ELEMINDEX, PSI) 
 ELEMINDEX contains indexes of elements to be rotated
 PSI - angle(s) of rotation in RADIANS
   POSITIVE PSI corresponds to a CORKSCREW (right) 
   rotation of the ELEMENT.
   (or CORKSCREW, aligned with s-axis) rotation of the ELEMENT
   The misalgnment matrixes are stored in fields R1 and R2
   R1 = [  cos(PSI) sin(PSI); -sin(PSI) cos(PSI) ]
   R2 = R1'

  NOTES
  1. This function is deprecated. Use atsettilt instead

 See also SETSHIFT MKSROLLMAT

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function settilt(ELEMINDEX, PSI)
0002 %SETTILT sets the entrance and exit misalignment matrixes
0003 % of an element or a group of elements in THERING
0004 % Previously stored values are overwritten.
0005 %
0006 % SETTILT(ELEMINDEX, PSI)
0007 % ELEMINDEX contains indexes of elements to be rotated
0008 % PSI - angle(s) of rotation in RADIANS
0009 %   POSITIVE PSI corresponds to a CORKSCREW (right)
0010 %   rotation of the ELEMENT.
0011 %   (or CORKSCREW, aligned with s-axis) rotation of the ELEMENT
0012 %   The misalgnment matrixes are stored in fields R1 and R2
0013 %   R1 = [  cos(PSI) sin(PSI); -sin(PSI) cos(PSI) ]
0014 %   R2 = R1'
0015 %
0016 %  NOTES
0017 %  1. This function is deprecated. Use atsettilt instead
0018 %
0019 % See also SETSHIFT MKSROLLMAT
0020 
0021 global THERING
0022 
0023 numelems = length(ELEMINDEX);
0024 
0025 if numelems ~= length(PSI)
0026    error('ELEMINDEX and PSI must have the same number of elements');
0027 end
0028 
0029 C = cos(PSI);
0030 S = sin(PSI);
0031 
0032 for i = 1:length(ELEMINDEX)
0033    RM = diag([ C(i) C(i) C(i) C(i) 1  1 ]);
0034    RM(1,3) = S(i);
0035    RM(2,4) = S(i);
0036    RM(3,1) = -S(i);
0037    RM(4,2) = -S(i);
0038    THERING{ELEMINDEX(i)}.R1 = RM;
0039    THERING{ELEMINDEX(i)}.R2 = RM';
0040 end
0041 
0042

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