Commit a4f385dc authored by Simone Liuzzo's avatar Simone Liuzzo

temporary: always compute numeric dispersiona nd t derivative

parent 4b40e6db
......@@ -77,6 +77,7 @@ if isfield(qemres,'quadhdispresponse')
dDx_dq=qemres.quadhdispresponse;
else
end
disp('FIRST and only h.disp derivative with respect to quadrupoles');
disp('computation starts on lattice without errors/correctors');
[dDx_dq,~]=qemdispderiv(qemres(1).at,qemres.ct,@setk,1.e-3,...
......@@ -84,7 +85,7 @@ else
%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
function elem=setk(elem,dk)
k=elem.PolynomB(2)+dk;
......@@ -92,12 +93,13 @@ function elem=setk(elem,dk)
elem.PolynomB(2)=k;
end
qind=find(atgetcells(mach,'Class','Quadrupole'))'; % response matrix computed always at all quadrupoles
qind=find(atgetcells(mach,'Class','Quadrupole') )'; % | atgetcells(mach,'FamName','DQ\w*') response matrix computed always at all quadrupoles
% tune derivative analytic
if isfield(qemres,'quadtuneresponse')
dTunes_dq = qemres.quadtuneresponse ;
else
end
% 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)];
......@@ -105,7 +107,7 @@ else
dTunes_dq = betas /4 /pi .*L; % dQhv/dKn
qemres.quadtuneresponse = dTunes_dq;
disp('finished. stored in qemres.quadtuneresponse')
end
quadforresponse=find(ismember(qind,varidx)); % quadrupoles to use for fit amoung all
......
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