Commit 20939f96 authored by Simone Liuzzo's avatar Simone Liuzzo

derivative of dispersion and tune vs K_quad modified to be identical to numeric ones

parent b04b7f6a
......@@ -81,8 +81,8 @@ else
disp('computation starts on lattice without errors/correctors');
[dDx_dq,~]=qemdispderiv(qemres(1).at,qemres.ct,@setk,1.e-3,...
[varidx],qemres.bpmidx,dispfunc); % h dispersion derivative resepct to quadrupoles
dDx_dq=dDx_dq./qemres.qcorl(:,ones(1,size(dDx_dq,1)))'; % as in semskewresp
qemres.quadhdispresponse = dDx_dq;
%dDx_dq=dDx_dq./qemres.qcorl(:,ones(1,size(dDx_dq,1)))'; % as in semskewresp
qemres.quadhdispresponse = dDx_dq; % dDx/dKn
disp('finished. stored in qemres.quadhdispresponse')
end
......@@ -92,8 +92,6 @@ function elem=setk(elem,dk)
elem.PolynomB(2)=k;
end
dDx_dq=dDx_dq.*alpha_c/2;
qind=find(atgetcells(mach,'Class','Quadrupole'))'; % response matrix computed always at all quadrupoles
% tune derivative analytic
......@@ -104,7 +102,7 @@ else
[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;
dTunes_dq = betas /4 /pi .*L; % dQhv/dKn
qemres.quadtuneresponse = dTunes_dq;
disp('finished. stored in qemres.quadtuneresponse')
end
......@@ -117,11 +115,11 @@ for iq=1:nq
ib = quadforresponse(iq); % use only selected quadrupoles
rha=dX_dq(:,:,ib);
rva=dY_dq(:,:,ib);
dxdqa=[dDx_dq(:,ib);dTunes_dq(:,ib)]/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);
dxdqsa=[dDy_ds(:,ib)]/dval(iq);% analytic, no tune dispersion derivative very different from
dxdqsa=[dDy_ds(:,ib)];%/dval(iq) analytic, no tune dispersion derivative very different from
drespskew(:,iq)=[rhsa(:);rvsa(:);dxdqsa];
......
No preview for this file type
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