0001 function varargout = plotbeta(varargin)
0002
0003
0004
0005
0006
0007
0008
0009 global THERING
0010 if nargin == 0
0011 RING = THERING;
0012 else
0013 RING = varargin{1};
0014 end
0015
0016 L = length(RING);
0017 spos = findspos(RING,1:L+1);
0018
0019 [TD, tune] = twissring(RING,0,1:(length(RING)+1));
0020 BETA = cat(1,TD.beta);
0021 S = cat(1,TD.SPos);
0022
0023 disp(tune)
0024
0025 if nargin > 1 & ishandle(varargin{2})
0026 figure(varargin{2});
0027 else
0028 figure
0029 end
0030
0031
0032 subplot(2,1,1)
0033 plot(S,BETA(:,1),'.-b');
0034
0035 A = axis;
0036 A(1) = 0;
0037 A(2) = S(end);
0038 axis(A);
0039
0040 ylabel('\beta_x [m]');
0041 grid on
0042
0043
0044 title('\beta-functions');
0045
0046 subplot(2,1,2)
0047 plot(S,BETA(:,2),'.-r');
0048
0049 B = axis;
0050 axis([A(1:2) B(3:4)]);
0051 xlabel('s - position [m]');
0052 ylabel('\beta_y [m]');
0053 grid on