From ab4161ca2efcfa2f4f0604d569f3b2c45a415b62 Mon Sep 17 00:00:00 2001 From: Eugeniy Mikhailov Date: Wed, 19 Dec 2012 16:29:08 -0500 Subject: added z dependence summary plot --- xmds2/realistic_Rb_and_fields/field_delay_vs_z.m | 70 ++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 xmds2/realistic_Rb_and_fields/field_delay_vs_z.m 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); + + -- cgit v1.2.3