Home > atphysics > LinearOptics > plotbeta.m

plotbeta

PURPOSE ^

PLOTBETA plots UNCOUPLED! beta-functions

SYNOPSIS ^

function varargout = plotbeta(varargin)

DESCRIPTION ^

PLOTBETA plots UNCOUPLED! beta-functions
 PLOTBETA(RING) calculates beta functions of the lattice RING
 PLOTBETA with no argumnts uses THERING as the default lattice
  Note: PLOTBETA uses FINDORBIT4 and LINOPT which assume a lattice
  with NO accelerating cavities and NO radiation

 See also PLOTCOD

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function varargout = plotbeta(varargin)
0002 %PLOTBETA plots UNCOUPLED! beta-functions
0003 % PLOTBETA(RING) calculates beta functions of the lattice RING
0004 % PLOTBETA with no argumnts uses THERING as the default lattice
0005 %  Note: PLOTBETA uses FINDORBIT4 and LINOPT which assume a lattice
0006 %  with NO accelerating cavities and NO radiation
0007 %
0008 % See also PLOTCOD
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 % plot betax and betay in two subplots
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 %xlabel('s - position [m]');
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 % Set the same horizontal scale as beta x plot
0049 B = axis;
0050 axis([A(1:2) B(3:4)]);
0051 xlabel('s - position [m]');
0052 ylabel('\beta_y [m]');
0053 grid on

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