Home > pubtools > LatticeTuningFunctions > errors > setTiltGirderAbout.m

setTiltGirderAbout

PURPOSE ^

SYNOPSIS ^

function re=setTiltGirderAbout(r,mag_gr,coord,PSI)

DESCRIPTION ^


 See also: atsettilt atsettiltdipole atsetshift

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function re=setTiltGirderAbout(r,mag_gr,coord,PSI)
0002 %
0003 %
0004 % See also: atsettilt atsettiltdipole atsetshift
0005 
0006 %mag_gr=getMagGroupsFromGirderIndex(r);
0007 
0008 pos=[mag_gr{:}];
0009 
0010 numelems = length(pos);
0011 
0012 if (numelems ~= length(PSI))
0013     error('ELEMINDEX, D must have the same number of elements');
0014 end
0015 
0016 
0017 switch coord
0018     case 'x'
0019         for i = 1:length(pos)
0020             
0021             r{pos(i)}.T1(2) =  -PSI(i);
0022             r{pos(i)}.T2(2) =   PSI(i);
0023             r{pos(i)}.T1(1) =  -r{pos(i)}.Length/2*sin(PSI(i));
0024             r{pos(i)}.T2(1) =   r{pos(i)}.Length/2*sin(PSI(i));
0025             r{pos(i)}.RotAboutX =   PSI(i);
0026             %DS =+L/2(1-cos(psi) both in and out, ignored. (if including, do not change sign!)
0027            
0028         end
0029         r=ThetaPhiGirder(r,mag_gr);
0030         
0031     case 'y'
0032         for i = 1:length(pos)% angle is changing!
0033             
0034             r{pos(i)}.T1(4) =  -PSI(i);
0035             r{pos(i)}.T2(4) =   PSI(i);
0036             r{pos(i)}.T1(3) =  -r{pos(i)}.Length/2*sin(PSI(i));
0037             r{pos(i)}.T2(3) =   r{pos(i)}.Length/2*sin(PSI(i));
0038             r{pos(i)}.RotAboutY =   PSI(i);
0039             %DS =+L/2(1-cos(psi) both in and out, ignored. (if including, do not change sign!)
0040             
0041         end
0042         r=ThetaPhiGirder(r,mag_gr);
0043         
0044     case  's'
0045         r= atsettiltdipole(r,pos,PSI);
0046         r= UniformGirderErrors(r,mag_gr);
0047     otherwise
0048         disp('tilt about x, y or s');
0049 end
0050 
0051 
0052 
0053 re=r;

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