Commit c75046e3 authored by Simone Liuzzo's avatar Simone Liuzzo
Browse files

added errors on measured data

parent d0c7cfef
......@@ -33,7 +33,7 @@ v=v_zero;
v(index)=v(index)+obj.kick_rad;
obj.setHSteerersValues(v);
pause(2)
tra_p_Meas=obj.measuretrajectory;
[tra_p_Meas, err_tra_p_Meas]=obj.measuretrajectory;
v=v_zero;
......@@ -41,16 +41,18 @@ v(index)=v(index)-obj.kick_rad;
obj.setHSteerersValues(v);
pause(2)
tra_n_Meas=obj.measuretrajectory;
[tra_n_Meas, err_tra_n_Meas]=obj.measuretrajectory;
obj.setHSteerersValues(v_zero);
pause(2)
plane='H';indplane=1;
%simulations of trajectories with steerer index at +kick, 0 and -kick
tra_p_Sim=obj.SimulateTrajectoryKick(index,obj.kick_rad,plane);
% tra_z_Sim=obj.SimulateTrajectoryKick(index,0,plane);
tra_n_Sim=obj.SimulateTrajectoryKick(index,-obj.kick_rad,plane);
% compute dtraj_pos and dtraj_neg measured and simulated
dtra_Meas_H=tra_p_Meas(indplane,:)-tra_n_Meas(indplane,:);
err_dtra_Meas_H=sqrt(err_tra_p_Meas(indplane,:).^2 + err_tra_n_Meas(indplane,:).^2);
%dtra_n_Meas=tra_n_Meas(indplane,:)-traj_zero_Meas(indplane,:);
dtra_Sim_H=tra_p_Sim(indplane,:)-tra_n_Sim(indplane,:);
%dtra_n_Sim=tra_n_Sim(indplane,:)-traj_zero_Sim(indplane,:);
......@@ -73,7 +75,7 @@ v(index)=v(index)+obj.kick_rad;
obj.setVSteerersValues(v);
pause(2)
tra_p_Meas=obj.measuretrajectory;
[tra_p_Meas, err_tra_p_Meas]=obj.measuretrajectory;
v=v_zero;
......@@ -81,8 +83,10 @@ v(index)=v(index)-obj.kick_rad;
obj.setVSteerersValues(v);
pause(2)
tra_n_Meas=obj.measuretrajectory;
[tra_n_Meas, err_tra_n_Meas]=obj.measuretrajectory;
obj.setVSteerersValues(v_zero);
pause(2)
plane='V';indplane=2;
%simulations of trajectories with steerer index at +kick, 0 and -kick
tra_p_Sim=obj.SimulateTrajectoryKick(index,obj.kick_rad,plane);
......@@ -90,6 +94,7 @@ tra_n_Sim=obj.SimulateTrajectoryKick(index,-obj.kick_rad,plane);
% compute dtraj_pos and dtraj_neg measured and simulated
dtra_Meas_V=tra_p_Meas(indplane,:)-tra_n_Meas(indplane,:);
err_dtra_Meas_V=sqrt(err_tra_p_Meas(indplane,:).^2 + err_tra_n_Meas(indplane,:).^2);
dtra_Sim_V=tra_p_Sim(indplane,:)-tra_n_Sim(indplane,:);
indbpmafter=bpmafter(1:obj.nbpm_after);
......@@ -105,14 +110,14 @@ ErrorV=100*rms(dtra_Meas_V(indbpmafter)-dtra_Sim_V(indbpmafter))/rms(dtra_Sim_V(
if(obj.plot)
figure;
subplot(2,1,1)
plot(dtra_Meas_H(indbpmafter),'.-','LineWidth',2,'MarkerSize',12,'DisplayName','Measured');
errorbar(dtra_Meas_H(indbpmafter),err_dtra_Meas_H(indbpmafter),'.-','LineWidth',2,'MarkerSize',12,'DisplayName','Measured');
hold on; grid on;
plot(dtra_Sim_H(indbpmafter),'.-','LineWidth',2,'MarkerSize',12,'DisplayName','Simulated');
l=legend('Location','NorthWest');
title(l,['Hor err=' num2str(ErrorH,'%1.1f') '%']);
ylabel('\Delta traj H')
subplot(2,1,2)
plot(dtra_Meas_V(indbpmafter),'.-','LineWidth',2,'MarkerSize',12,'DisplayName','Measured');
errorbar(dtra_Meas_V(indbpmafter),err_dtra_Meas_V(indbpmafter),'.-','LineWidth',2,'MarkerSize',12,'DisplayName','Measured');
hold on; grid on;
plot(dtra_Sim_V(indbpmafter),'.-','LineWidth',2,'MarkerSize',12,'DisplayName','Simulated');
ylabel('\Delta traj V')
......
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