BEAM22 computes the beam matrix from the 1-turn transfer matrix % BEAM=BEAM22(T) T: 1-turn transfer matrix BEAM: envelope matrix [BEAM,TUNE]=BEAM22(T) also returns the tune
0001 function [s,tune] = beam22(t) 0002 %BEAM22 computes the beam matrix from the 1-turn transfer matrix 0003 %% 0004 %BEAM=BEAM22(T) 0005 % T: 1-turn transfer matrix 0006 % BEAM: envelope matrix 0007 % 0008 %[BEAM,TUNE]=BEAM22(T) 0009 % also returns the tune 0010 0011 cosmu=0.5*trace(t); 0012 sinmu=sign(t(1,2))*sqrt(1-cosmu*cosmu); 0013 alpha=0.5*(t(1,1)-t(2,2))/sinmu; 0014 beta=t(1,2)/sinmu; 0015 s=[beta -alpha; -alpha (alpha*alpha+1)/beta]; 0016 tune=atan2(sinmu,cosmu)/2/pi; 0017 end 0018