source: MML/trunk/machine/SOLEIL/StorageRing/insertions/idAuxLargestIntersectionOfVectors.m

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

To have a stable version on the server.

  • Property svn:executable set to *
File size: 1007 bytes
Line 
1function OutputVector=idAuxLargestIntersectionOfVectors(Vector1, Vector2)
2%% Written by F.Briquez     25/04/2011
3% Returns the outter limits of the vector included in both Vector1 and
4% Vector2
5% 1) Inputs :   Vector1 : (1xN1) array. Must be increasing monotonic!
6%               Vector2 : (1xN2) array. Must be increasing monotonic!
7% 2) Output :   Vector (1x2) = [lower limit, upper limit]
8% 3) Returns empty array [] if failed
9
10%%
11OutputVector=[];
12
13N1=length(Vector1);
14N2=length(Vector2);
15   
16for i=1:N1-1
17    if (Vector1(i)>Vector1(i+1))
18        fprintf ('Error in ''idAuxLargestIntersectionOfVectors'' : Vector1 must be increasing monotonic\n');
19        return
20    end
21end
22for i=1:N2-1
23    if (Vector2(i)>Vector2(i+1))
24        fprintf ('Error in ''idAuxLargestIntersectionOfVectors'' : Vector2 must be increasing monotonic\n');
25        return
26    end
27end
28ResultStart=max(Vector1(1), Vector2(1));
29ResultEnd=min(Vector1(length(Vector1)), Vector2(length(Vector2)));
30OutputVector=[ResultStart, ResultEnd];
Note: See TracBrowser for help on using the repository browser.