Home > pubtools > LatticeTuningFunctions > errors > errorsmanipulation > SumErrors.m

SumErrors

PURPOSE ^

rsum=SumErrors(r1,r2,magindex)

SYNOPSIS ^

function rsum=SumErrors(r1,r2,magindex,indBPM)

DESCRIPTION ^

 rsum=SumErrors(r1,r2,magindex)
 
 gets errors from r1 and r2 and sum them into rsum

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function rsum=SumErrors(r1,r2,magindex,indBPM)
0002 % rsum=SumErrors(r1,r2,magindex)
0003 %
0004 % gets errors from r1 and r2 and sum them into rsum
0005 %
0006 
0007 if length(r1)~=length(r2)
0008     error('r1 and r2 must be the same lattice with different errors!')
0009 end
0010 
0011 if nargin<3
0012     magindex=1:length(r1);
0013 end
0014 
0015 [X1,Y1,S1,T1,R1,P1,bpm1]=GetExistingErrors(r1,magindex);
0016 [X2,Y2,S2,T2,R2,P2,bpm2]=GetExistingErrors(r2,magindex);
0017 
0018 bpms.offsetx=bpm1.offsetx+bpm2.offsetx;
0019 bpms.offsety=bpm1.offsety+bpm2.offsety;
0020 bpms.rotation=bpm1.rotation+bpm2.rotation;
0021 
0022 rsum=SetExistingError(r1,magindex,indBPM,...
0023     X1+X2,...
0024     Y1+Y2,...
0025     S1+S2,...
0026     T1+T2,...
0027     R1+R2,...
0028     P1+P2,...
0029     bpms...
0030     );
0031 
0032 
0033 return

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