summaryrefslogtreecommitdiff
path: root/xmds2/realistic_Rb_and_fields/field_delay_vs_z.m
blob: 34b287c5dd79a6dbd91ea299bdbd96ba577d3bc7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
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);

fh=figure(1);
niceplotset(fh);
%errorbar(z_1, delay_time, delay_time_err, '.-');
plot(z_1, delay_time, '.-');
title('Pulse delay vs distance');
xlabel('z (m)');
ylabel('delay (S)');
print('delay_vs_z_for_Ip2.eps', '-depsc');

fh=figure(2);
niceplotset(fh);
plot(z_1, sqrt(max_powerIp2), '.-');
title('Pulse Ip2 strength vs distance');
xlabel('z (m)');
ylabel('Field Rabi frequency (Mrad/s)');
print('field_vs_z_for_Ip2.eps', '-depsc');

fh=figure(3);
niceplotset(fh);
plot(z_1, sqrt(max_powerIm1), '.-');
title('Pulse Im1 strength vs distance');
xlabel('z (m)');
ylabel('Field Rabi frequency (Mrad/s)');

fh=figure(4);
niceplotset(fh);
plot(z_1, sqrt(max_powerIm3), '.-');
title('Pulse Im3 strength vs distance');
xlabel('z (m)');
ylabel('Field Rabi frequency (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);