-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathplotarticle.m
More file actions
313 lines (262 loc) · 9.93 KB
/
plotarticle.m
File metadata and controls
313 lines (262 loc) · 9.93 KB
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
function plotarticle(x, t, sol, PAR)
% Plotting the results
disp('Plotting Results')
% Unwrapping parameters
l = PAR(1); A_i = PAR(2); A_o = PAR(3); O_m = PAR(4);
g_K0 = PAR(5); g_Na = PAR(6); g_Cl = PAR(7); C_m = PAR(8);
c_Ko0 = PAR(9); c_Ki0 = PAR(10); c_Nao0 = PAR(11); c_Nai0 = PAR(12);
c_Clo0 = PAR(13); c_Cli0 = PAR(14);
v_m0 = PAR(15); X_iZ_i = PAR(16); X_oZ_o = PAR(17);
R = PAR(18); F = PAR(19); T = PAR(20); psifac = PAR(21);
D_K = PAR(22); D_Na = PAR(23); D_Cl = PAR(24);
lambda_i = PAR(25); lambda_o = PAR(26);
tstart = PAR(27); tstop = PAR(28); xstart = PAR(29); xstop = PAR(30);
Imax = PAR(31); Kdec = PAR(32);
R = 8.315; % Gas constant J*mol^-1*K^-1;
F = 96500; % Faraday's constant (C/mol);
psifac = R*T/F; % Standard potential RT/F(V);
c_Ko = sol(:,:,1);
c_Ki = sol(:,:,2);
c_Nao = sol(:,:,3);
c_Nai = sol(:,:,4);
c_Clo = sol(:,:,5);
c_Cli = sol(:,:,6);
v_mo = sol(:,:,7);
v_mi = sol(:,:,8);
for j = 1:length(t)
%Derivative of c_Ko v/ at all t given by duoutdx1 (V/m);
[uout1(j,:),duoutdx1(j,:)] = pdeval(0,x,sol(j,:,1),x);
[uout2(j,:),duoutdx2(j,:)] = pdeval(0,x,sol(j,:,2),x);
[uout3(j,:),duoutdx3(j,:)] = pdeval(0,x,sol(j,:,3),x);
[uout4(j,:),duoutdx4(j,:)] = pdeval(0,x,sol(j,:,4),x);
[uout5(j,:),duoutdx5(j,:)] = pdeval(0,x,sol(j,:,5),x);
[uout6(j,:),duoutdx6(j,:)] = pdeval(0,x,sol(j,:,6),x);
[uout7(j,:),duoutdx7(j,:)] = pdeval(0,x,sol(j,:,7),x);
end
% Input/Output-vectors
Kinput = zeros(size(sol(:,:,1)));
Koutput = zeros(size(sol(:,:,1)));
I_tstart = min(find(t>=tstart));
I_tstop = max(find(t<tstop));
I_xstart = min(find(x>=xstart));
I_xstop = max(find(x<=xstop));
Kinput(I_tstart:I_tstop, I_xstart:I_xstop) = Imax*10^6; %Convert to micromol/(m^2s)
Koutput = Kdec*(c_Ko - c_Ko0)*10^6; %Convert to micromol/(m^2s)
%Flux densities due to diffusion (mol/(m^2*s));
j_KoD = -(D_K/lambda_o^2)*duoutdx1;
j_KiD = -(D_K/lambda_i^2)*duoutdx2;
j_NaoD = -(D_Na/lambda_o^2)*duoutdx3;
j_NaiD = -(D_Na/lambda_i^2)*duoutdx4;
j_CloD = -(D_Cl/lambda_o^2)*duoutdx5;
j_CliD = -(D_Cl/lambda_i^2)*duoutdx6;
%Current densities due to diffusion (A/m^2);
i_odiff = F*(j_KoD + j_NaoD - j_CloD);
i_idiff = F*(j_KiD + j_NaiD - j_CliD);
%Resistivities (ohm*m)
r_o = psifac*lambda_o^2./(F*(D_Na*c_Nao+D_K*c_Ko+D_Cl*c_Clo));
r_i = psifac*lambda_i^2./(F*(D_Na*c_Nai+D_K*c_Ki+D_Cl*c_Cli));
% Gradients of v_o og v_i (V/m)
dv_odx = (-duoutdx7 + r_i.*i_idiff+r_i*(A_o/A_i).*i_odiff).*r_o./(r_o+r_i*A_o/A_i);
dv_idx = (duoutdx7 + r_o.*(A_i/A_o).*i_idiff+r_o.*i_odiff).*(r_i./(r_i+r_o*A_i/A_o));
%Flux densities due to electrical migration(mol/(m^2*s));
j_KoV = -(D_K/lambda_o^2).*(1/psifac).*c_Ko.*dv_odx;
j_KiV = -(D_K/lambda_i^2).*(1/psifac).*c_Ki.*dv_idx;
j_NaoV = -(D_Na/lambda_o^2).*(1/psifac).*c_Nao.*dv_odx;
j_NaiV = -(D_Na/lambda_i^2).*(1/psifac).*c_Nai.*dv_idx;
j_CloV = (D_Cl/lambda_o^2).*(1/psifac).*c_Clo.*dv_odx;
j_CliV = (D_Cl/lambda_i^2).*(1/psifac).*c_Cli.*dv_idx;
%Current densities due to electrical migration (A/m^2);
i_ofield = F*(j_KoV + j_NaoV - j_CloV);
i_ifield = F*(j_KiV + j_NaiV - j_CliV);
% Total axial current densities (A/m^2);
i_i = i_idiff + i_ifield;
i_o = i_odiff + i_ofield;
%%% Membrane mechanisms
P = NaKpumprate(c_Ko, c_Nai); % Na/K pumprate (mol/(m^2*s));
f_Kir = Kirf(c_Ko,c_Ki,c_Ko0,c_Ki0, v_mo, v_m0, psifac); % Kir-factor (unitless)
% Membrane-flux densities (mol/(m^2*s));
j_KM = (g_K0.*f_Kir/F).*(v_mo-psifac.*log(c_Ko./c_Ki)) - 2*P;
j_NaM = (g_Na/F).*(v_mo-psifac.*log(c_Nao./c_Nai)) + 3*P;
j_ClM = -(g_Cl/F).*(v_mo+psifac.*log(c_Clo./c_Cli));
%Membrane current density (A/m^2);
i_m = F*(j_KM + j_NaM - j_ClM);
%% Nernst potentials (V)
eNa = psifac*log(c_Nao./c_Nai);
eK = psifac*log(c_Ko./c_Ki);
eCl = -psifac*log(c_Clo./c_Cli);
% Indices for plotting
ItSS = max(find(t<tstop)); % time point while in steady state
Ixiz = 1; % x-value in input zone (x = 0)
%%% Some colors
ColK = [0.2 0.1 0.8]; % Blue
ColNa = [0.4 0.8 0.4]; %Green
ColCl = [0.8 0.2 0.7]; %Magenta
Cole = [1 0.7 0]; %Yellow
ColV = [0 0 0]; %Black
ColIN = [0 0 0]; %Black
Colr = [0 0 0]; % Black
x = x*1000; % convert to mm.
%% FIGURE 1: CONCENTRATION PROFILES
figure('position', [60 90 800 750], ...
'name', 'Dynamics and Steady State profiles (Fig. 4 in Halnes et al. 2013)')
subplot(4,2,1) % Input
hold on;
plot(t, Kinput(:,Ixiz), 'Color', ColK, 'LineStyle', '-', 'LineWidth',2.0);
plot(t, -Koutput(:,Ixiz), 'Color', ColK, 'LineStyle', '--', 'LineWidth',2.0);
ylabel('j_K (\mu mol m^{-2}s^{-1})', 'FontSize', 12);
axis([0 600 -0.25 0.57])
subplot(4,2,3) % Extracellular concentrations in input zone (t)
c_Qo = c_Ko + c_Nao - c_Clo;
c_Qo0 = c_Ko0 + c_Nao0 - c_Clo0;
hold on
h=plot(t,c_Ko(:,Ixiz)-c_Ko0, 'Color', ColK);
set(h,'LineWidth',1.5);
h = plot(t, c_Nao(:,Ixiz)-c_Nao0, 'Color', ColNa);
set(h,'LineWidth',1.5);
h = plot(t, c_Clo(:,Ixiz)-c_Clo0, 'Color', ColCl);
set(h,'LineWidth',1.5);
h = plot(t, c_Qo(:,Ixiz) - c_Qo0, 'Color', Cole);
set(h,'LineWidth',1.5);
ylabel('\Delta [k]_{E} (mM)', 'fontsize', 12);
axis([0 600 -35 10]);
subplot(4,2,5)%% Intracellular concentrations in input zone (t):
hold on
c_Qi = c_Ki + c_Nai - c_Cli;
c_Qi0 = c_Ki0 + c_Nai0 - c_Cli0;
hold on
h=plot(t,c_Ki(:,Ixiz)-c_Ki0, 'Color', ColK);
set(h,'LineWidth',1.5);
h = plot(t, c_Nai(:,Ixiz)-c_Nai0, 'Color', ColNa);
set(h,'LineWidth',1.5);
h = plot(t, c_Cli(:,Ixiz)-c_Cli0, 'Color', ColCl);
set(h,'LineWidth',1.5);
h = plot(t, c_Qi(:,Ixiz) - c_Qi0, 'Color', Cole);
set(h,'LineWidth',1.5);
ylabel('\Delta [k]_{I} (mM)', 'fontsize', 12);
axis([0 600 -8 15])
subplot(4,2,7) % Voltage in input zone (t)
hold on;
h = plot(t, 1000*v_mo(:,[Ixiz])','Color', ColV);
set(h,'LineWidth',1.5);
xlabel('t (s)', 'FontSize', 12);
ylabel('v_M(mV)', 'FontSize', 12);
axis([0 600 -85 -55])
subplot(4,2,2) % Input/output during SS(x)
hold on
plot(x, Kinput(ItSS,:), 'Color', ColK, 'LineWidth', 1.5);
plot(x, -Koutput(ItSS,:),'Color', ColK, 'LineStyle', '--' , 'LineWidth', 1.5);
h = legend('j_K^{in}', 'j_K^{out}');
set(h, 'fontsize', 12)
axis([0 0.3 -0.25 0.57]);
subplot(4,2,4) % Extracellular concentrations during SS (x)
hold on
c_Qo = c_Ko + c_Nao - c_Clo;
c_Qo0 = c_Ko0 + c_Nao0 - c_Clo0;
h = plot(x,c_Ko(ItSS,:)-c_Ko0, 'Color', ColK);
set(h,'LineWidth',1.5);
h = plot(x, c_Nao(ItSS,:)-c_Nao0, 'Color', ColNa);
set(h,'LineWidth',1.5);
h = plot(x, c_Clo(ItSS,:)-c_Clo0, 'Color', ColCl);
set(h,'LineWidth',1.5);
h = plot(x, c_Qo(ItSS,:) - c_Qo0, 'Color', Cole);
set(h,'LineWidth',1.5);
axis([0 0.3 -35 10])
subplot(4,2,6) % Intracellular concentrations during SS (x)
c_Qi = c_Ki + c_Nai - c_Cli;
c_Qi0 = c_Ki0 + c_Nai0 - c_Cli0;
hold on
h = plot(x,c_Ki(ItSS,:)-c_Ki0, 'Color', ColK);
set(h,'LineWidth',1.5);
h = plot(x, c_Nai(ItSS,:)-c_Nai0, 'Color', ColNa);
set(h,'LineWidth',1.5);
h = plot(x, c_Cli(ItSS,:)-c_Cli0, 'Color', ColCl);
set(h,'LineWidth',1.5);
h = plot(x, c_Qi(ItSS,:) - c_Qi0, 'Color', Cole);
set(h,'LineWidth',1.5);
h = legend('K^+','Na^+', 'Cl^-', 'e^+');
set(h, 'fontsize', 12)
axis([0 0.3 -8 15])
subplot(4,2,8) % Voltage during SS (x)
hold on
h = plot(x, 1000*v_mo(ItSS,:)','Color', ColV);
set(h,'LineWidth',1.5);
xlabel('x (mm)', 'FontSize', 12);
axis([0 0.3 -85 -55])
%% FIGURE: MATTER CYCLING DURING SS
figure('position', [60 90 800 750], ...
'name', 'Matter transports (flux densities) during steady state (Fig. 5 in Halnes et al. 2013)')
subplot(3,2,1) % Input/Output flux densities
hold on
set(gca, 'ColorOrder', [ColK;ColNa;ColCl;Cole]);
plot(x, Kinput(ItSS,:)-Koutput(ItSS,:), 'Color', ColK, 'LineWidth', 1.5);
plot(x, -Kinput(ItSS,:)+Koutput(ItSS,:), 'Color', ColNa, 'LineWidth', 1.5);
ylabel('j_k^{in}-j_k^{out}', 'fontsize', 12);
axis([0 0.3 -0.4 0.4]);
subplot(3,2,2) % Membrane flux densities
hold on
set(gca, 'ColorOrder', [ColK;ColNa;ColCl;Cole]);
j_QM = j_KM + j_NaM - j_ClM;
h = plot(x, 1e6*[j_KM(ItSS,:)', j_NaM(ItSS,:)', j_ClM(ItSS,:)', j_QM(ItSS,:)']);
set(h, 'LineWidth', 1.5);
ylabel('j_{kM}', 'fontsize', 12);
h = legend('K^+','Na^+', 'Cl^-', 'e^+');
set(h, 'fontsize', 10)
AX = axis; AX(2) = 0.3; axis(AX);
axis([0 0.3 -0.3 0.12]);
subplot(3,2,3)%% Extacellular field-flux densities:
hold on
j_QoV = (j_KoV + j_NaoV - j_CloV);
set(gca, 'ColorOrder', [ColK;ColNa;ColCl;Cole]);
h = plot(x, A_o*1e6*[j_KoV(ItSS,:)', j_NaoV(ItSS,:)', j_CloV(ItSS,:)', j_QoV(ItSS,:)']);
set(h, 'LineWidth', 1.5);
ylabel('a_Ej_{kE}^f', 'fontsize', 12);
axis([0 0.3 -100 55]);
subplot(3,2,4) % Intracellular field-flux densities
hold on
set(gca, 'ColorOrder', [ColK;ColNa;ColCl;Cole]);
j_QiV = (j_KiV + j_NaiV - j_CliV);
h = plot(x, A_i*1e6*[j_KiV(ItSS,:)', j_NaiV(ItSS,:)', j_CliV(ItSS,:)', j_QiV(ItSS,:)']);
set(h, 'LineWidth', 1.5);
ylabel('a_Ij_{kI}^f', 'fontsize', 12);
axis([0 0.3 -10 70]);
subplot(3,2,5) % Extracellular diffusion-flux densities
hold on
set(gca, 'ColorOrder', [ColK;ColNa;ColCl;Cole]);
j_QoD = (j_KoD + j_NaoD - j_CloD);
h = plot(x, A_o*1e6*[j_KoD(ItSS,:)', j_NaoD(ItSS,:)', j_CloD(ItSS,:)', j_QoD(ItSS,:)']);
set(h, 'LineWidth', 1.5);
ylabel('a_Ej_{kE}^d', 'fontsize', 12);
axis([0 0.3 -53 27]);
xlabel('x (mm)', 'fontsize', 12);
subplot(3,2,6) % Intracellular diffusion-flux densities
hold on
set(gca, 'ColorOrder', [ColK;ColNa;ColCl;Cole]);
j_QiD = j_KiD + j_NaiD - j_CliD;
h = plot(x, A_i*1e6*[j_KiD(ItSS,:)', j_NaiD(ItSS,:)', j_CliD(ItSS,:)', j_QiD(ItSS,:)']);
set(h, 'LineWidth', 1.5);
ylabel('a_Ij_{kI}^d', 'fontsize', 12);
axis([0 0.3 -3 9]);
xlabel('x (mm)', 'fontsize', 12);
%% FIGURE: Potassium uptake
figure('position', [60 90 400 750], ...
'name', 'Potassium uptake/release during steady state (Fig. 6 in Halnes et al. 2013)')
AbsKirflux = (g_K0.*f_Kir/F).*(v_mo-psifac.*log(c_Ko./c_Ki))
AbsPumpflux = 2*P;
subplot(2, 1, 1)
hold on
h = plot(x, 1000*v_mo(ItSS,:)','k-');
set(h,'LineWidth',1.5);
h = plot(x, 1000*eK(ItSS,:)','b-');
set(h,'LineWidth',1.5);
xlabel('x (mm)', 'fontsize', 12);
ylabel('mV', 'FontSize', 12);
h = legend('v_M','e_K');
axis([0 0.3 -90 -55]);
subplot(2,1, 2)
hold on;
plot(x, 1e6*AbsKirflux(ItSS,:)', 'b--', 'LineWidth',2.0);
plot(x, 1e6*AbsPumpflux(ItSS,:)', 'b-', 'LineWidth',2.0);
xlabel('x (mm)', 'fontsize', 12);
ylabel('j (\mumol/(m^2 s))', 'fontsize', 12);
h = legend('|j_{Kir}|','|j_{Na^+/K^+ exchanger}|');
axis([0 0.3 0.55 1.1]);