summaryrefslogtreecommitdiff
path: root/xmds2/Nlevels_no_dopler_with_z_4wm_with_perturbations/pp.m
blob: 9ca3195cf7696ef7f3f55f211f274e470a69ea59 (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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
Nlevels_no_dopler_with_z_4wm_with_perturbations

%% field propagation
z_1=z_1*100; % z in cm
t_1=t_1*1e6; % time now measured in uS
figure(1)
subplot(2,2,1); imagesc(z_1, t_1, I1_out_1); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('I_1')
title('I_1')
subplot(2,2,2); imagesc(z_1, t_1, I2_out_1); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('I_2')
title('I_2')
subplot(2,2,3); imagesc(z_1, t_1, I3_out_1); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('I_3')
title('I_3')
subplot(2,2,4); imagesc(z_1, t_1, I4_out_1); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('I_4')
title('I_4')


print('-color','fields_propagation.eps')



%% fields before and after the cell
figure(2)
subplot(2,2,1);
plot( ...
	t_1,I1_out_1(:,1),'-;before;', "linewidth", 4,  ...
	t_1,I1_out_1(:,end), '-;after;', "linewidth", 4 ...
	)
xlabel('t (uS)')
ylabel('I_1 (1/s)^2')
title('I_1 before and after cell')
subplot(2,2,2);
plot( ...
	t_1,I2_out_1(:,1),'-;before;', "linewidth", 4,  ...
	t_1,I2_out_1(:,end), '-;after;', "linewidth", 4 ...
	)
xlabel('t (uS)')
ylabel('I_2 (1/s)^2')
title('I_2 before and after cell')
subplot(2,2,3);
plot( ...
	t_1,I3_out_1(:,1),'-;before;', "linewidth", 4,  ...
	t_1,I3_out_1(:,end), '-;after;', "linewidth", 4 ...
	)
xlabel('t (uS)')
ylabel('I_3 (1/s)^2')
title('I_3 before and after cell')

[b, a]=butter(3, 0.05);
I2_out_after=I2_out_1(:,end);
I2_out_after_filtered=filtfilt(b,a,I2_out_after);
settling_time=0.8; %uS
t_good_indx=t_1> min(t_1 + settling_time);
[m,max_pos_before]=max(I2_out_1(t_good_indx,1) ); [m,max_pos_after]=max(I2_out_after_filtered(t_good_indx));
delay_time=t_1(max_pos_after)-t_1(max_pos_before);
printf('Second field delay time  = %f uS\n',delay_time);

print('-color','fields_before_after_cell.eps')

subplot(2,2,4);
plot( ...
	t_1,I4_out_1(:,1),'-;before;', "linewidth", 4,  ...
	t_1,I4_out_1(:,end), '-;after;', "linewidth", 4 ...
	)
xlabel('t (uS)')
ylabel('I_3 (1/s)^2')
title('I_3 before and after cell')

figure(4)
I2_max_in=max(I2_out_1(t_good_indx,1));
I2_max_out=max(I2_out_1(t_good_indx,end));
I2_in_norm=(I2_out_1(:,1))/I2_max_in;
I2_out_norm=(I2_out_1(:,end))/I2_max_out;
tmin=-0.05;
tmax=0.05;
indx=(t_1>=tmin & t_1<=tmax);  % soom in in time to this region
plot( ...
	t_1(indx),I2_in_norm(indx),'-;before;', "linewidth", 4,  ...
	t_1(indx),I2_out_norm(indx), '-;after;', "linewidth", 4 ...
	)
xlim([tmin,tmax],'manual');	
xlabel('t (uS)')
ylabel('I_2')
title('I_2 before and after cell normalized')
print('-color','probe_before_after_cell.eps')

return;

%% all density matrix elements in one plot
% diagonal populations, 
% upper triangle real part of coherences, 
% lower diagonal imaginary part of coherences
z_2=z_2*100; % z in cm
t_2=t_2*1e6; % time now measured in uS
figure(3)
subplot(4,4,1); imagesc (z_2, t_2, r11_out_2);  caxis([0,1]); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('rho_{11}')
title('rho_{11}')
subplot(4,4,6); imagesc (z_2, t_2, r22_out_2);  caxis([0,1]); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('rho_{22}')
title('rho_{22}')
subplot(4,4,11); imagesc (z_2, t_2, r33_out_2);  caxis([0,1]); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('rho_{33}')
title('rho_{33}')
subplot(4,4,16); imagesc (z_2, t_2, r44_out_2); caxis([0,1]);  colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('rho_{44}')
title('rho_{44}')
% real parts of coherences
subplot(4,4,2); imagesc(z_2, t_2, r12_re_out_2); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('Real(rho_{12})')
title('Real(rho_{12})')
subplot(4,4,3); imagesc(z_2, t_2, r13_re_out_2); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('Real(rho_{13})')
title('Real(rho_{13})')
subplot(4,4,4); imagesc(z_2, t_2, r14_re_out_2); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('Real(rho_{14})')
title('Real(rho_{14})')
subplot(4,4,7); imagesc(z_2, t_2, r23_re_out_2); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('Real(rho_{23})')
title('Real(rho_{23})')
subplot(4,4,8); imagesc(z_2, t_2, r24_re_out_2); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('Real(rho_{24})')
title('Real(rho_{24})')
subplot(4,4,12); imagesc(z_2, t_2, r34_re_out_2); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('Real(rho_{34})')
title('Real(rho_{34})')
% imaginary parts of coherences
subplot(4,4,5); imagesc(z_2, t_2, r12_im_out_2); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('Imag(rho_{12})')
title('Imag(rho_{12})')
subplot(4,4,9); imagesc(z_2, t_2, r13_im_out_2); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('Imag(rho_{13})')
title('Imag(rho_{13})')
subplot(4,4,10); imagesc(z_2, t_2, r23_im_out_2); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('Imag(rho_{23})')
title('Imag(rho_{23})')
subplot(4,4,13); imagesc(z_2, t_2, r14_im_out_2); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('Imag(rho_{14})')
title('Imag(rho_{14})')
subplot(4,4,14); imagesc(z_2, t_2, r24_im_out_2); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('Imag(rho_{24})')
title('Imag(rho_{24})')
subplot(4,4,15); imagesc(z_2, t_2, r34_im_out_2); colorbar
xlabel('z (cm)')
ylabel('t (uS)')
zlabel('Imag(rho_{34})')
title('Imag(rho_{34})')