PLOTCOD Closed Orbit Distortion PLOTCOD(RING,DP) finds and plots closed orbit for a given momentum deviation DP. It calls FINDORBIT4 which assumes a lattice with NO accelerating cavities and NO radiation INPUTS 1. RING - At structure 2. DP - Energy offset OUTPUTS (Optional) 1. orbit - (x,px,y,py) closed orbit along the ring See Also plotbeta
0001 function varargout = plotcod(RING,DP) 0002 %PLOTCOD Closed Orbit Distortion 0003 % PLOTCOD(RING,DP) finds and plots closed orbit for a given momentum 0004 % deviation DP. It calls FINDORBIT4 which assumes a lattice 0005 % with NO accelerating cavities and NO radiation 0006 % 0007 % INPUTS 0008 % 1. RING - At structure 0009 % 2. DP - Energy offset 0010 % 0011 % OUTPUTS (Optional) 0012 % 1. orbit - (x,px,y,py) closed orbit along the ring 0013 % 0014 % See Also plotbeta 0015 0016 % Written by Andrei Terebilo 0017 % Modified by Laurent S. Nadolski 0018 % March 27, 2005 - Default input arguments added 0019 0020 switch nargin 0021 case 0 0022 global THERING; 0023 RING = THERING; 0024 DP = 0.0; % on mometum closed orbit 0025 case 1 0026 DP = 0; % on momentum closed orbit 0027 otherwise 0028 %do nothing 0029 end 0030 0031 0032 localspos = findspos(RING,1:length(RING)+1); 0033 orbit = findorbit4(RING,DP,1:length(RING)+1); 0034 %orbit = findorbit6(RING,1:length(RING)+1); 0035 0036 plot(localspos,orbit(1,:)*1e3,'.-r'); 0037 title('Closed Orbit Distortion') 0038 hold on 0039 plot(localspos,orbit(3,:)*1e3,'.-b'); 0040 hold off 0041 0042 A = axis; 0043 A(1:2) = [0, localspos(end)]; 0044 axis(A); 0045 0046 legend('Horizontal','Vertical'); 0047 xlabel('s - position [m]'); 0048 ylabel('orbit [mm]'); 0049 0050 grid on 0051 0052 if nargout > 0 0053 varargout{1} = orbit; 0054 end