0001
0002 clear all
0003
0004 load('dba.mat','RING');
0005 addpath(fullfile(pwd,'..'))
0006
0007
0008 C=atcorrector('C',0,0);
0009 M=atmarker('BPM');
0010
0011
0012 arc=[{M};RING(1:18);RING(128:end)];
0013
0014 indq=findcells(arc,'Class','Quadrupole');
0015 for iq=2:2:length(indq)
0016 arc=[arc(1:indq(iq)-1);M;C;arc(indq(iq):end)];
0017 indq=findcells(arc,'Class','Quadrupole');
0018 end
0019
0020
0021 hcor=findcells(arc,'FamName','C');
0022
0023 Variab=atVariableBuilder(arc,...
0024 {[hcor(1), hcor(end)],[hcor(2),hcor(end-1)]},...
0025 {{'KickAngle'}});
0026
0027
0028 bpm=findcells(arc,'FamName','BPM');
0029
0030 c1=atlinconstraint(...
0031 [bpm(1)],...
0032 {{'ClosedOrbit',{1}},{'ClosedOrbit',{2}}},...
0033 [1e-3,0],...
0034 [1e-3,0],...
0035 [1e-2 1e-2]);
0036
0037 c2=atlinconstraint(...
0038 [bpm(2:end-1)],{{'ClosedOrbit',{1}}},0,0,1e-2);
0039
0040 c=[c1,c2];
0041
0042
0043 arc_bump=atmatch(arc,Variab,c,10^-15,1000,3,@lsqnonlin);
0044 figure;atplot(arc_bump,@plClosedOrbit);
0045
0046