Commit a23773ea authored by Simone Liuzzo's avatar Simone Liuzzo

added analyitic tune derivative (TO BE TESTED)

parent aeb356d6
......@@ -85,6 +85,7 @@ else
qemres.quadhdispresponse = dDx_dq;
disp('finished. stored in qemres.quadhdispresponse')
end
function elem=setk(elem,dk)
k=elem.PolynomB(2)+dk;
elem.K=k;
......@@ -92,8 +93,22 @@ function elem=setk(elem,dk)
end
dDx_dq=dDx_dq.*alpha_c/2;
qind=find(atgetcells(mach,'Class','Quadrupole'))'; % response matrix computed always at all quadrupoles
% tune derivative analytic
if isfield(qemres,'quadtuneresponse')
dTunes_dq = qemres.quadtuneresponse ;
else
% dnu = - beta/4/pi * dkl
[l,~,~]=atlinopt(mach,0,qind);
betas = [arrayfun(@(a)a.beta(1),l,'un',1);arrayfun(@(a)a.beta(2),l,'un',1)];
L = cellfun(@(a)a.Length,mach(qind),'un',1)';
dTunes_dq = - betas /4 /pi .*L;
qemres.quadtuneresponse = dTunes_dq;
disp('finished. stored in qemres.quadtuneresponse')
end
quadforresponse=find(ismember(qind,varidx)); % quadrupoles to use for fit amoung all
dispfunc(2,3);
......@@ -102,7 +117,7 @@ for iq=1:nq
ib = quadforresponse(iq); % use only selected quadrupoles
rha=dX_dq(:,:,ib);
rva=dY_dq(:,:,ib);
dxdqa=[dDx_dq(:,ib);0;0]/dval(iq);% analytic, no tune dispersion derivative very different from
dxdqa=[dDx_dq(:,ib);dTunes_dq(:,ib)]/dval(iq);% analytic, no tune dispersion derivative very different from
dresp(:,iq)=[rha(:);rva(:);dxdqa];
rhsa=dXY_ds(:,:,ib);
rvsa=dYX_ds(:,:,ib);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment