-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot_3MealTypes.m
257 lines (233 loc) · 9.79 KB
/
plot_3MealTypes.m
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
% Plots 3 outputs from driverMeal.m with compute_vars output
% Choose MealOnly, KCl Only and Meal + KCl to show the 3 Preston
% experiments
clear all;
%% load data
% Meal Only simulation results
f_MealOnly = './MealSim/29-Sep-2023_driverMeal_insulin-1_Kin-0_notes-try1.mat';
f_KClOnly = './MealSim/29-Sep-2023_driverMeal_insulin-0_Kin-35_notes-try1.mat';
f_MealKCl = './MealSim/29-Sep-2023_driverMeal_insulin-1_Kin-35_notes-try1.mat';
dat1 = load(f_MealOnly);
dat2 = load(f_KClOnly);
dat3 = load(f_MealKCl);
% Preston et al data file name
f_PrestonDat = './PrestonData/20-Jun-2023_PrestonData.mat';
PrestonDat = load(f_PrestonDat);
lab1 = 'Meal Only';
lab2 = 'KCl Only';
lab3 = 'Meal + KCl';
%% make figures
fprintf('making figures \n')
% figure specs
lw = 3;
f.xlab = 16; f.ylab = 16; f.title = 18;
f.leg = 16;
cmap = parula(7);
c1 = cmap(1,:);
c2 = cmap(3,:);
c3 = cmap(5,:);
ls1 = '-'; ls2 = ':'; ls3 = '-.';
cgraymap = gray(5);
cgray = cgraymap(3,:);
lwgray = 2; lsgray = '--';
leglabs = {lab1, lab2, lab3};
%% variables
figure(10)
clf
nrows = 2; ncols = 2;
subplot(nrows,ncols,1)
hold on
plot(dat1.t,dat1.y(:,1),'linewidth',lw,'color',c1, 'linestyle',ls1)
plot(dat2.t,dat2.y(:,1),'linewidth',lw,'color',c2, 'linestyle',ls2)
plot(dat3.t, dat3.y(:,1),'linewidth',lw,'color',c3,'linestyle',ls3)
ylabel('M_{Kgut}', 'fontsize', f.ylab)
xlabel('t', 'fontsize', f.xlab)
title('Gut K', 'fontsize', f.title)
grid on
subplot(nrows,ncols,2)
hold on
plot(dat1.t,dat1.y(:,2),'linewidth',lw,'color',c1, 'linestyle',ls1)
plot(dat2.t,dat2.y(:,2),'linewidth',lw,'color',c2, 'linestyle',ls2)
plot(dat3.t, dat3.y(:,2),'linewidth',lw,'color',c3,'linestyle',ls3)
ylabel('M_{Kplas}', 'fontsize', f.ylab)
xlabel('t', 'fontsize', f.xlab)
title('Plasma K', 'fontsize', f.title)
grid on
subplot(nrows,ncols,3)
hold on
plot(dat1.t,dat1.y(:,3),'linewidth',lw,'color',c1, 'linestyle',ls1)
plot(dat2.t,dat2.y(:,3),'linewidth',lw,'color',c2, 'linestyle',ls2)
plot(dat3.t, dat3.y(:,3),'linewidth',lw,'color',c3,'linestyle',ls3)
ylabel('M_{Kinter}', 'fontsize', f.ylab)
xlabel('t', 'fontsize', f.xlab)
title('Interstitial K', 'fontsize', f.title)
grid on
subplot(nrows,ncols,4)
hold on
plot(dat1.t,dat1.y(:,4),'linewidth',lw,'color',c1, 'linestyle',ls1)
plot(dat2.t,dat2.y(:,4),'linewidth',lw,'color',c2, 'linestyle',ls2)
plot(dat3.t, dat3.y(:,4),'linewidth',lw,'color',c3,'linestyle',ls3)
ylabel('M_{Kmuscle}', 'fontsize', f.ylab)
xlabel('t', 'fontsize', f.xlab)
title('Muscle K', 'fontsize', f.title)
grid on
legend(leglabs, 'fontsize', f.leg)
% subplot(nrows,ncols,5)
% hold on
% %Nal_vals1 = [dat1.vals1.Nal_vals; dat1.vals2.Nal_vals; dat1.vals3.Nal_vals];
% plot(dat1.t,dat1.y(:,5),'linewidth',lw,'color',c1, 'linestyle',ls1)
% %plot(dat2.t,dat2.y(:,5),'linewidth',lw,'color',c2, 'linestyle',ls2)
% Nal_vals2 = [dat2.vals1.Nal_vals; dat2.vals2.Nal_vals; dat2.vals3.Nal_vals];
% plot(dat2.t,Nal_vals2, 'linewidth',lw,'color',c2,'linestyle',ls2)
% Nal_vals3 = [dat3.vals1.Nal_vals; dat3.vals2.Nal_vals; dat3.vals3.Nal_vals];
% plot(dat3.t,Nal_vals3, 'linewidth',lw,'color',c3,'linestyle',ls3)
% ylabel('N_{al}', 'fontsize', f.ylab)
% xlabel('t', 'fontsize', f.xlab)
% title('Normalized ALD', 'fontsize', f.title)
% grid on
%% concentrations
figure(11)
clf
nrows = 1; ncols = 3;
subplot(nrows,ncols,1)
hold on
plot(dat1.t,dat1.y(:,2)/dat1.pars.V_plasma,'linewidth',lw,'color',c1, 'linestyle',ls1)
plot(dat2.t,dat2.y(:,2)/dat2.pars.V_plasma,'linewidth',lw,'color',c2, 'linestyle',ls2)
plot(dat3.t,dat3.y(:,2)/dat3.pars.V_plasma,'linewidth',lw,'color',c3, 'linestyle',ls3)
yline(3.5,'color',cgray,'linestyle',lsgray, 'linewidth', lwgray)
yline(5.0,'color',cgray,'linestyle',lsgray, 'linewidth', lwgray)
ylabel('[K^+]_{plasma}', 'fontsize', f.ylab)
xlabel('t', 'fontsize', f.xlab)
title('Plasma K concentration', 'fontsize', f.title)
grid on
subplot(nrows,ncols,2)
hold on
plot(dat1.t,dat1.y(:,3)/dat1.pars.V_interstitial,'linewidth',lw,'color',c1, 'linestyle',ls1)
plot(dat2.t,dat2.y(:,3)/dat2.pars.V_interstitial,'linewidth',lw,'color',c2, 'linestyle',ls2)
plot(dat3.t,dat3.y(:,3)/dat3.pars.V_interstitial,'linewidth',lw,'color',c3, 'linestyle',ls3)
yline(3.5,'color',cgray,'linestyle',lsgray, 'linewidth', lwgray)
yline(5.0,'color',cgray,'linestyle',lsgray, 'linewidth', lwgray)
ylabel('[K^+]_{inter}', 'fontsize', f.ylab)
xlabel('t', 'fontsize', f.xlab)
title('Interstitial K concentration', 'fontsize', f.title)
grid on
subplot(nrows,ncols,3)
hold on
plot(dat1.t,dat1.y(:,4)/dat1.pars.V_muscle,'linewidth',lw,'color',c1, 'linestyle',ls1)
plot(dat2.t,dat2.y(:,4)/dat2.pars.V_muscle,'linewidth',lw,'color',c2, 'linestyle',ls2)
plot(dat3.t,dat3.y(:,4)/dat3.pars.V_muscle,'linewidth',lw,'color',c3, 'linestyle',ls3)
yline(120,'color',cgray,'linestyle',lsgray, 'linewidth', lwgray)
yline(140,'color',cgray,'linestyle',lsgray, 'linewidth', lwgray)
ylabel('[K^+]_{muscle}', 'fontsize', f.ylab)
xlabel('t', 'fontsize', f.xlab)
title('Muscle K concentration', 'fontsize', f.title)
grid on
legend(leglabs, 'fontsize', f.leg)
%% feedforward and feedback response
figure(15)
clf
nrows = 2; ncols = 2;
subplot(nrows,ncols,1)
hold on
rhoins1 = [dat1.vals1.rho_insulin; dat1.vals2.rho_insulin; dat1.vals3.rho_insulin];
rhoins2 = [dat2.vals1.rho_insulin; dat2.vals2.rho_insulin; dat2.vals3.rho_insulin];
rhoins3 = [dat3.vals1.rho_insulin; dat3.vals2.rho_insulin; dat3.vals3.rho_insulin];
plot(dat1.t, rhoins1, 'linewidth',lw,'color',c1,'linestyle',ls1)
plot(dat2.t, rhoins2, 'linewidth',lw,'color',c2,'linestyle',ls2)
plot(dat3.t, rhoins3, 'linewidth',lw,'color',c3,'linestyle',ls3)
ylabel('\rho_{ins}', 'fontsize', f.ylab)
xlabel('t', 'fontsize', f.xlab)
title('[insulin] effect on \Phi_{ECtoIC} (\rho_{insulin})', 'fontsize', f.title)
grid on
subplot(nrows,ncols,2)
hold on
rhoal1 = [dat1.vals1.rho_al; dat1.vals2.rho_al; dat1.vals3.rho_al];
rhoal2 = [dat2.vals1.rho_al; dat2.vals2.rho_al; dat2.vals3.rho_al];
rhoal3 = [dat3.vals1.rho_al; dat3.vals2.rho_al; dat3.vals3.rho_al];
plot(dat1.t, rhoal1, 'linewidth',lw,'color',c1,'linestyle',ls1)
plot(dat2.t, rhoal2,'linewidth',lw,'color',c2,'linestyle',ls2)
plot(dat3.t, rhoal3,'linewidth',lw,'color',c3,'linestyle',ls3)
ylabel('\rho_{al}', 'fontsize', f.ylab)
xlabel('t','fontsize',f.xlab)
title('[ALD] effect on \Phi_{ECtoIC} (\rho_{al})', 'fontsize', f.title)
grid on
subplot(nrows,ncols,3)
hold on
gamkin1 = [dat1.vals1.gamma_Kin; dat1.vals2.gamma_Kin; dat1.vals3.gamma_Kin];
gamkin2 = [dat2.vals1.gamma_Kin; dat2.vals2.gamma_Kin; dat2.vals3.gamma_Kin];
gamkin3 = [dat3.vals1.gamma_Kin; dat3.vals2.gamma_Kin; dat3.vals3.gamma_Kin];
plot(dat1.t, gamkin1, 'linewidth',lw,'color',c1,'linestyle',ls1)
plot(dat2.t, gamkin2,'linewidth',lw,'color',c2,'linestyle',ls2)
plot(dat3.t, gamkin3, 'linewidth',lw,'color',c3,'linestyle',ls3)
ylabel('\gamma_{Kin}', 'fontsize', f.ylab)
xlabel('t', 'fontsize', f.xlab)
title('GI feedforward effect (\gamma_{Kin})', 'fontsize', f.title)
grid on
subplot(nrows,ncols,4)
hold on
gamal1 = [dat1.vals1.gamma_al; dat1.vals2.gamma_al; dat1.vals3.gamma_al];
gamal2 = [dat2.vals1.gamma_al; dat2.vals2.gamma_al; dat2.vals3.gamma_al];
gamal3 = [dat3.vals1.gamma_al; dat3.vals2.gamma_al; dat3.vals3.gamma_al];
plot(dat1.t, gamal1, 'linewidth', lw,'color',c1,'linestyle',ls1)
plot(dat2.t, gamal2, 'linewidth',lw,'color',c2,'linestyle',ls2)
plot(dat3.t, gamal3, 'linewidth',lw,'color',c3,'linestyle',ls3)
ylabel('gamma_{al}', 'fontsize', f.ylab)
xlabel('t','fontsize',f.xlab)
title('[ALD] effect on \Phi_{dt-Ksec} (\gamma_{al})', 'fontsize', f.title)
grid on
legend(leglabs, 'fontsize', f.leg)
%% kidney
figure(21)
clf
nrows = 2; ncols = 2;
subplot(nrows,ncols,1)
hold on
filK1 = [dat1.vals1.filK; dat1.vals2.filK; dat1.vals3.filK];
filK2 = [dat2.vals1.filK; dat2.vals2.filK; dat2.vals3.filK];
filK3 = [dat3.vals1.filK; dat3.vals2.filK; dat3.vals3.filK];
plot(dat1.t, filK1, 'linewidth',lw,'color',c1,'linestyle',ls1)
plot(dat2.t, filK2, 'linewidth',lw,'color',c2,'linestyle',ls2)
plot(dat3.t, filK3, 'linewidth',lw,'color',c3,'linestyle',ls3)
ylabel('fil_K', 'fontsize', f.ylab)
xlabel('t','fontsize',f.xlab)
title('Filtered K^+ load', 'fontsize', f.title)
grid on
subplot(nrows,ncols,2)
hold on
dtKsec1 = [dat1.vals1.dtKsec; dat1.vals2.dtKsec; dat1.vals3.dtKsec];
dtKsec2 = [dat2.vals1.dtKsec; dat2.vals2.dtKsec; dat2.vals3.dtKsec];
dtKsec3 = [dat3.vals1.dtKsec; dat3.vals2.dtKsec; dat3.vals3.dtKsec];
plot(dat1.t, dtKsec1, 'linewidth',lw,'color',c1,'linestyle',ls1)
plot(dat2.t, dtKsec2, 'linewidth',lw,'color',c2,'linestyle',ls2)
plot(dat3.t, dtKsec3, 'linewidth',lw,'color',c3,'linestyle',ls3)
ylabel('\Phi_{dt-Ksec}', 'fontsize', f.ylab)
xlabel('t','fontsize',f.xlab)
title('DT K^+ secretion', 'fontsize', f.title)
grid on
subplot(nrows,ncols,3)
hold on
cdKtrans1 = [dat1.vals1.cdKsec; dat1.vals2.cdKsec; dat1.vals3.cdKsec] ...
- [dat1.vals1.cdKreab; dat1.vals2.cdKreab; dat1.vals3.cdKreab];
cdKtrans2 = [dat2.vals1.cdKsec; dat2.vals2.cdKsec; dat2.vals3.cdKsec] ...
- [dat2.vals1.cdKreab; dat2.vals2.cdKreab; dat2.vals3.cdKreab];
cdKtrans3 = [dat3.vals1.cdKsec; dat3.vals2.cdKsec; dat3.vals3.cdKsec]...
- [dat3.vals1.cdKreab; dat3.vals2.cdKreab; dat3.vals3.cdKreab];
plot(dat1.t, cdKtrans1, 'linewidth',lw,'color',c1,'linestyle',ls1)
plot(dat2.t, cdKtrans2, 'linewidth',lw,'color',c2,'linestyle',ls2)
plot(dat3.t, cdKtrans3, 'linewidth',lw,'color',c3,'linestyle',ls3)
ylabel('\Phi_{cd-Ksec} - \Phi_{cd-Kreab}', 'fontsize', f.ylab)
xlabel('t','fontsize',f.xlab)
title('CD K^+ transport', 'fontsize', f.title)
grid on
subplot(nrows,ncols,4)
hold on
uK1 = [dat1.vals1.UrineK; dat1.vals2.UrineK; dat1.vals3.UrineK];
uK2 = [dat2.vals1.UrineK; dat2.vals2.UrineK; dat2.vals3.UrineK];
uK3 = [dat3.vals1.UrineK; dat3.vals2.UrineK; dat3.vals3.UrineK];
plot(dat1.t, uK1, 'linewidth',lw,'color',c1,'linestyle',ls1)
plot(dat2.t, uK2, 'linewidth',lw,'color',c2,'linestyle',ls2)
plot(dat3.t, uK3, 'linewidth',lw,'color',c3,'linestyle',ls3)
ylabel('\Phi_{uK}', 'fontsize', f.ylab)
xlabel('t','fontsize',f.xlab)
title('Urine K^+ excretion', 'fontsize', f.title)
grid on