Home > lattice > atloadfielderrs.m

atloadfielderrs

PURPOSE ^

ATLOADFIELDERRS will load a field error structure into a ring

SYNOPSIS ^

function ring = atloadfielderrs(ring,fielderrstruct)

DESCRIPTION ^

 ATLOADFIELDERRS will load a field error structure into a ring
 field error structure has the fields: 
 elemindex: element indices in ring to impact
 Nval: reference mpole #, e.g. 2 for Quad, 3 for Sextupole
 nval: multipole index to change
 Bval: Value of relative normal coefficient
 Aval: Value of relative skew coefficient
 radius: reference radius used to compute error

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function ring = atloadfielderrs(ring,fielderrstruct)
0002 % ATLOADFIELDERRS will load a field error structure into a ring
0003 % field error structure has the fields:
0004 % elemindex: element indices in ring to impact
0005 % Nval: reference mpole #, e.g. 2 for Quad, 3 for Sextupole
0006 % nval: multipole index to change
0007 % Bval: Value of relative normal coefficient
0008 % Aval: Value of relative skew coefficient
0009 % radius: reference radius used to compute error
0010 
0011 elemindex=fielderrstruct.elemindex;
0012 newindex=fielderrstruct.nval;
0013 refindex=fielderrstruct.Nval;
0014 Bval=fielderrstruct.Bval;
0015 Aval=fielderrstruct.Aval;
0016 radius=fielderrstruct.radius;
0017 
0018 for j=1:length(elemindex);
0019     elem=ring{elemindex(j)};
0020     polyB=elem.PolynomB;
0021     polyA=elem.PolynomA;
0022     
0023     
0024     polyB=ataddmpolecomppoly(polyB,refindex(j),newindex(j),Bval(j),radius);
0025     polyA=ataddmpolecomppoly(polyA,refindex(j),newindex(j),Aval(j),radius,polyB(refindex(j)));
0026     
0027     
0028     elem.PolynomB=polyB;
0029     elem.PolynomA=polyA;
0030     elem.MaxOrder=length(polyB);
0031     ring{elemindex(j)}=elem;
0032 end

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