source: MML/trunk/at/atphysics/plotbeta.m @ 4

Last change on this file since 4 was 4, checked in by zhangj, 10 years ago

Initial import--MML version from SOLEIL@2013

File size: 1.1 KB
Line 
1function varargout = plotbeta(varargin)
2%PLOTBETA plots UNCOUPLED! beta-functions
3% PLOTBETA(RING) calculates beta functions of the lattice RING
4% PLOTBETA with no argumnts uses THERING as the default lattice
5%  Note: PLOTBETA uses FINDORBIT4 and LINOPT which assume a lattice
6%  with NO accelerating cavities and NO radiation
7%
8% See also PLOTCOD
9global THERING
10if nargin == 0
11        RING = THERING;
12else
13    RING = varargin{1};
14end
15
16L = length(RING);
17spos = findspos(RING,1:L+1);
18
19[TD, tune] = twissring(RING,0,1:(length(RING)+1));
20BETA = cat(1,TD.beta);
21S  = cat(1,TD.SPos);
22
23disp(tune)
24
25if nargin > 1 & ishandle(varargin{2})
26    figure(varargin{2});
27else
28    figure
29end
30% plot betax and betay in two subplots
31
32subplot(2,1,1)
33plot(S,BETA(:,1),'.-b');
34
35A = axis;
36A(1) = 0;
37A(2) = S(end);
38axis(A);
39%xlabel('s - position [m]');
40ylabel('\beta_x [m]','Interpreter', 'Tex');
41grid on
42
43
44title('\beta-functions','Interpreter', 'Tex');
45
46subplot(2,1,2)
47plot(S,BETA(:,2),'.-r');
48% Set the same horizontal scale as beta x plot
49B = axis;
50axis([A(1:2) B(3:4)]);
51xlabel('s - position [m]');
52ylabel('\beta_y [m]','Interpreter', 'Tex');
53grid on
Note: See TracBrowser for help on using the repository browser.