Home > pubtools > LatticeTuningFunctions > errors > setANYshift.m

setANYshift

PURPOSE ^

SYNOPSIS ^

function re=setANYshift(r,pos,coord,D)

DESCRIPTION ^

 adds to the existing shift errors additional D
 
 See also SETSHIFT

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function re=setANYshift(r,pos,coord,D)
0002 %
0003 % adds to the existing shift errors additional D
0004 %
0005 % See also SETSHIFT
0006 
0007 numelems = length(pos);
0008 
0009 if coord<1 | coord>6
0010     error('coord should be an index vector between 1 and 6')
0011 end
0012 
0013 if (numelems ~= length(D))
0014     error('pos, D must have the same number of elements');
0015 end
0016 
0017 additive=0;% errors are overwritten if this flag is 0.
0018 
0019 for i = 1:length(pos)
0020     if abs(D(i))<1e-12, D(i)=0; end;
0021     
0022     if additive
0023         r{pos(i)}.T1(coord,1) = r{pos(i)}.T1(coord,1) -D(i);
0024         r{pos(i)}.T2(coord,1) = r{pos(i)}.T1(coord,1) +D(i);
0025     else % no T1 and T2 defined
0026         r{pos(i)}.T1(coord,1) =  -D(i);
0027         r{pos(i)}.T2(coord,1) =   D(i);
0028     end
0029 end
0030 
0031 re=r;

Generated on Thu 24-Aug-2017 18:47:33 by m2html © 2005