source: MML/trunk/at/atphysics/mcf.m @ 5

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

Initial import--MML version from SOLEIL@2013

File size: 806 bytes
Line 
1function alpha = mcf(RING)
2%MCF - Calculates momentum compaction factor (MCF) of RING
3%
4% INPUTS
5% 1. RING - Cell describing the RING in AT
6%
7% OUTPUTS
8% 1. alpha - Momentum compaction factor
9
10%
11% Modified by Laurent S. Nadolski
12% Symmetry around 0 added for computing (second order finite difference)
13
14if nargin < 1
15    error('Syntax is mcf(RING)');
16elseif ~iscell(RING)
17    error('argument is not a AT RING')
18end
19
20dP    = 1e-6;
21coddpn = findorbit4(RING,-dP/2); % negative offset
22coddpp = findorbit4(RING,+dP/2); % positive offset
23
24% Build initial condition vector that starts
25% on the fixed point
26X0dPp = [coddpp; dP/2; 0];
27X0dPn = [coddpn;-dP/2;0];
28
29% Tracks X0 over 1 turn
30T = ringpass(RING,[X0dPn X0dPp]);
31
32% Calculates alpha
33L0    = findspos(RING,length(RING)+1);
34alpha = (T(6,2)-T(6,1))/(dP*L0);
35
Note: See TracBrowser for help on using the repository browser.