source: MML/trunk/mml/at/plotbeta2.m @ 4

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

Initial import--MML version from SOLEIL@2013

File size: 1.3 KB
Line 
1function varargout = plotbeta(varargin)
2% PLOTBETA(RING) finds and plots bea-functions of RING
3%  It calls FindOrbit4 and LinOpt which assume a lattice
4%  with NO accelerating cavities and NO radiation
5%
6% PLOTBETA with no argumnts uses THERING as a default RING
7%
8% See also PLOTCOD
9if nargin == 0
10        global THERING
11        RING = THERING;
12end
13L = length(RING);
14spos = findspos(RING,1:L+1);
15[twissdata, tunes, chrom] = twissring(RING,0,1:L+1,'chrom');
16RINGLength = spos(L)+RING{L}.Length;
17betax = zeros(1,L);
18betay = zeros(1,L);
19for i =1:L
20   betax(i) = twissdata(i).beta(1);
21   betay(i) = twissdata(i).beta(2);
22end
23betax(L+1) = betax(1);
24betay(L+1) = betay(1);
25fprintf('nux=%g, nuy=%g\n',tunes(1),tunes(2));
26fprintf('chromaticity xix=%g, xiy=%g\n',chrom(1),chrom(2));
27
28figure
29% plot betax and betay in two subplots
30
31subplot(2,1,1)
32%plot(spos,betax,'.-b'); Laurent sometimes negative !
33plot(spos,abs(betax),'.-b');
34A= axis;
35A(1) = 0;
36A(2) = RINGLength;
37axis(A);
38xlabel('s - position [m]');
39ylabel('\beta_x [m]');
40grid on
41
42
43title('beta-functions');
44
45subplot(2,1,2)
46%plot(spos,betay,'.-r'); Laurent sometimes negative !
47plot(spos,abs(betay),'.-r');
48A= axis;
49A(1) = 0;
50A(2) = RINGLength;
51axis(A);
52xlabel('s - position [m]');
53ylabel('\beta_y [m]');
54grid on
55addlabel(datestr(now));
56
57if nargout > 0
58        varargout{1}=betax;
59end
60if nargout ==2
61        varargout{2}=betay;
62end
Note: See TracBrowser for help on using the repository browser.