summaryrefslogtreecommitdiff
path: root/xmds2/realistic_Rb_and_fields
diff options
context:
space:
mode:
Diffstat (limited to 'xmds2/realistic_Rb_and_fields')
-rw-r--r--xmds2/realistic_Rb_and_fields/field_delay_vs_z.m70
1 files changed, 70 insertions, 0 deletions
diff --git a/xmds2/realistic_Rb_and_fields/field_delay_vs_z.m b/xmds2/realistic_Rb_and_fields/field_delay_vs_z.m
new file mode 100644
index 0000000..471708f
--- /dev/null
+++ b/xmds2/realistic_Rb_and_fields/field_delay_vs_z.m
@@ -0,0 +1,70 @@
+realistic_Rb_and_fields;
+
+dt=mean(diff(t_1));
+Ip2_b = Ip2_out_1(:,1);
+Ip2_a = Ip2_out_1(:,end);
+
+[c, lags] = xcov(Ip2_a, Ip2_b);
+[m, i] = max(c);
+
+delay_time = dt*lags(i);
+
+% delay in nS
+str= sprintf('delay_time_with_xcov= %f nS', 1e9*delay_time);
+disp(str);
+
+
+Nz=length(z_1);
+
+% settling time to avoid border transients
+i_settling=ceil(0.1*length(t_1));
+
+
+pcenter_i=zeros(1,Nz);
+perr_i=zeros(1,Nz);
+
+for i=1:Nz
+ % pulse center fit
+ [pcenter_i(i), perr_i(i)] = find_pulse_center(t_1', Ip2_out_1(:, i) );
+ % maximum power levels
+ max_powerIp2(i)=max( Ip2_out_1(i_settling:end, i) );
+ max_powerIm1(i)=max( Im1_out_1(i_settling:end, i) );
+ max_powerIm3(i)=max( Im3_out_1(i_settling:end, i) );
+end
+
+delay_time = pcenter_i - pcenter_i(1);
+delay_time_err = sqrt( perr_i.^2 + (perr_i(1))^2);
+
+figure(1)
+%errorbar(z_1, delay_time, delay_time_err, '.-');
+plot(z_1, delay_time, '.-');
+title('Pulse delay vs propagation distance');
+xlabel('z (m)');
+ylabel('delay (S)');
+
+figure(2)
+plot(z_1, max_powerIp2, '.-');
+title('Pulse Ip2 strength vs propagation distance');
+xlabel('z (m)');
+ylabel('Pulse strength (Mrad/s)');
+
+figure(3)
+plot(z_1, max_powerIm1, '.-');
+title('Pulse Im1 strength vs propagation distance');
+xlabel('z (m)');
+ylabel('Pulse strength (Mrad/s)');
+
+figure(4)
+plot(z_1, max_powerIm3, '.-');
+title('Pulse Im3 strength vs propagation distance');
+xlabel('z (m)');
+ylabel('Pulse strength (Mrad/s)');
+
+% final delay output
+str= sprintf('delay_time_with_fit= %f nS', 1e9*delay_time(end));
+disp(str);
+
+str= sprintf('delay_time_error_with_fit= %f nS', 1e9*delay_time_err(end));
+disp(str);
+
+