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:
984 bytes
|
Line | |
---|
1 | function spos = findspos(LINE,REFPTS) |
---|
2 | %FINDSPOS returns longitudinal positions of accelerator lattice elements. |
---|
3 | % Return value is a vector of positions S at the entrance of each element |
---|
4 | % specified by its number in REFPTS |
---|
5 | % |
---|
6 | % Note: REFPTS is an array of increasing indexes that |
---|
7 | % select elements from range 1 to length(LATTICE)+1. |
---|
8 | % REFPTS is allowed to go 1 point beyond the |
---|
9 | % number of elements. In this case the last point is |
---|
10 | % the EXIT of the last element. If LATTICE is a RING |
---|
11 | % it is also the entrance of the first element after 1 turn. |
---|
12 | % |
---|
13 | % Note: |
---|
14 | % 1. Use findspos(RING,1:length(RING)) for to find |
---|
15 | % longitudinal position of all elements |
---|
16 | % 2. Use findspos(LINE,length(LINE)+1) to find the |
---|
17 | % total physical length |
---|
18 | % 3. If line is a closed ring, exit of the last element |
---|
19 | % is also the entrance to the first. |
---|
20 | |
---|
21 | NEp1 = length(LINE) + 1; |
---|
22 | |
---|
23 | L = zeros(1,NEp1); |
---|
24 | |
---|
25 | for k = 2:NEp1 |
---|
26 | L(k) = L(k-1) + LINE{k-1}.Length; |
---|
27 | end |
---|
28 | |
---|
29 | spos = L(REFPTS); |
---|
Note: See
TracBrowser
for help on using the repository browser.