summaryrefslogtreecommitdiff
path: root/benchmark/benchmark.m
blob: e32486baf6078fbb1c0b52ba83026e10d3bab9be (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
% will plot on the same graph results of xmds and navy fortran calculations

Gamma_super = 6*2*pi*1e6;

% first we load navy fortran results

d=load('../fortran/navy_four_levels/Movie4level_EndPoints.dat');
t_fortran=d(:,1);
t_fortran=t_fortran*1e6;  % switch to uS
Om1_strt=d(:,2);
Om_vac_strt=d(:,3);
Om1_end=d(:,4);
Om_vac_end=d(:,5);

%figure(1)
%plot(t_fortran, Om1_strt, '-;Om1_{strt};', t_fortran, Om_vac_strt, '-;Om_{vac_{strt}};', t_fortran,  Om1_end, '-;Om1_{end};', t_fortran,Om_vac_end, '-;Om_{vac_{end}};');
%xlabel('Time (uS)');
%ylabel('Rabi frequency');

% second xmds results
%% fields before and after the cell
fpDat = fopen('../xmds2/Nlevels_no_dopler_with_z/Nlevels_no_dopler_with_z_mg0.dat', 'r', 'ieee-le');
if (fpDat < 0)
  disp('Cannot open binary data file: Nlevels_no_dopler_with_z_mg0.dat')
  return
end
z_1Len = fread(fpDat, 1, 'uint32');
z_1 = zeros(1, z_1Len);
z_1(:) = fread(fpDat, z_1Len, 'double');
t_1Len = fread(fpDat, 1, 'uint32');
t_1 = zeros(1, t_1Len);
t_1(:) = fread(fpDat, t_1Len, 'double');
I1_out_1Len = fread(fpDat, 1, 'uint32');
I1_out_1 = fread(fpDat, [t_1Len, z_1Len], 'double');
I2_out_1Len = fread(fpDat, 1, 'uint32');
I2_out_1 = fread(fpDat, [t_1Len, z_1Len], 'double');
I3_out_1Len = fread(fpDat, 1, 'uint32');
I3_out_1 = fread(fpDat, [t_1Len, z_1Len], 'double');
fclose(fpDat);
clear fpDat z_1Len t_1Len I1_out_1Len I2_out_1Len I3_out_1Len 

t_xmds=t_1/1e-6;  % move to uS
% watch for factor 2 in Rabi frequency calculations
Om1_xmds=2*sqrt(I1_out_1)/Gamma_super; % normalize output



figure(1)
plot( ...
	t_xmds, Om1_xmds(:,1), '-;Om1 before;',  ...
	t_xmds, Om1_xmds(:,end), '-;Om1 xmds after;', ...
	t_fortran,  Om1_end, '-;Om1 fortran after;' ...
	)
xlabel('Time (uS)');
ylabel('Normalized Rabi frequency');

print('xmds_vs_fortran.pdf')