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 | |
---|
1 | function 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 |
---|
9 | global THERING |
---|
10 | if nargin == 0 |
---|
11 | RING = THERING; |
---|
12 | else |
---|
13 | RING = varargin{1}; |
---|
14 | end |
---|
15 | |
---|
16 | L = length(RING); |
---|
17 | spos = findspos(RING,1:L+1); |
---|
18 | |
---|
19 | [TD, tune] = twissring(RING,0,1:(length(RING)+1)); |
---|
20 | BETA = cat(1,TD.beta); |
---|
21 | S = cat(1,TD.SPos); |
---|
22 | |
---|
23 | disp(tune) |
---|
24 | |
---|
25 | if nargin > 1 & ishandle(varargin{2}) |
---|
26 | figure(varargin{2}); |
---|
27 | else |
---|
28 | figure |
---|
29 | end |
---|
30 | % plot betax and betay in two subplots |
---|
31 | |
---|
32 | subplot(2,1,1) |
---|
33 | plot(S,BETA(:,1),'.-b'); |
---|
34 | |
---|
35 | A = axis; |
---|
36 | A(1) = 0; |
---|
37 | A(2) = S(end); |
---|
38 | axis(A); |
---|
39 | %xlabel('s - position [m]'); |
---|
40 | ylabel('\beta_x [m]','Interpreter', 'Tex'); |
---|
41 | grid on |
---|
42 | |
---|
43 | |
---|
44 | title('\beta-functions','Interpreter', 'Tex'); |
---|
45 | |
---|
46 | subplot(2,1,2) |
---|
47 | plot(S,BETA(:,2),'.-r'); |
---|
48 | % Set the same horizontal scale as beta x plot |
---|
49 | B = axis; |
---|
50 | axis([A(1:2) B(3:4)]); |
---|
51 | xlabel('s - position [m]'); |
---|
52 | ylabel('\beta_y [m]','Interpreter', 'Tex'); |
---|
53 | grid on |
---|
Note: See
TracBrowser
for help on using the repository browser.