-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun_simulation.m
164 lines (130 loc) · 29.1 KB
/
run_simulation.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
clear all
close all
scale = 0.5;
ptr = mx_alloc_simulation();
border = [[0;0],[0;50],[20;50],[20;30],[30;30],[30;50],[50;50],[50;0],[30;0],[30;20],[20;20],[20;0],[0;0]]*scale;
grid_width = 1*scale;
mx_setup_border(ptr, border, grid_width);
producer_area = [5, 15; 20 , 30]*scale;
producer_conc = 500000;
mx_setup_producers(ptr, producer_area, producer_conc);
%50 cells
%cells = [[40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25],[40; 25], [40; 25],...
% [40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25],[40; 25], [40; 25],...
% [40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25],[40; 25], [40; 25],...
% [40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25],[40; 25], [40; 25],...
% [40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25], [40; 25],[40; 25], [40; 25]]*scale;
% 1 cell
%cells = [[40; 25]]* scale;
cells = [[35;25]] * scale;
cells = [cells, cells];
cells = [cells, cells];
cells = [cells, cells]; % 8 cells
cells = [cells, cells];
cells = [cells, cells];
cells = [cells, cells];% 64 cells
cells = [cells, cells]; % 128 cells
cells = [cells, cells]; % 256 cells
% end 1 Cell
mx_insert_cells(ptr, cells);
% D, a, p
mx_set_diffusion_params(ptr, .1, .002, .000002);
% mu, lambda, a
mx_set_growth_params(ptr, 1/(30*60), 0, 2);
% initial plot
res = mx_get_cell_positions(ptr);
cmap = [0 0 0;0 0 0.579999983310699;0 0 0.583999991416931;0 0 0.587999999523163;0 0 0.592000007629395;0 0 0.596000015735626;0 0 0.600000023841858;0 0 0.603999972343445;0 0 0.607999980449677;0 0 0.611999988555908;0 0 0.61599999666214;0 0 0.620000004768372;0 0 0.624000012874603;0 0 0.628000020980835;0 0 0.632000029087067;0 0 0.635999977588654;0 0 0.639999985694885;0 0 0.643999993801117;0 0 0.648000001907349;0 0 0.65200001001358;0 0 0.656000018119812;0 0 0.660000026226044;0 0 0.663999974727631;0 0 0.667999982833862;0 0 0.671999990940094;0 0 0.675999999046326;0 0 0.680000007152557;0 0 0.684000015258789;0 0 0.688000023365021;0 0 0.691999971866608;0 0 0.695999979972839;0 0 0.699999988079071;0 0 0.703999996185303;0 0 0.708000004291534;0 0 0.712000012397766;0 0 0.716000020503998;0 0 0.720000028610229;0 0 0.723999977111816;0 0 0.727999985218048;0 0 0.73199999332428;0 0 0.736000001430511;0 0 0.740000009536743;0 0 0.744000017642975;0 0 0.748000025749207;0 0 0.751999974250793;0 0 0.755999982357025;0 0 0.759999990463257;0 0 0.763999998569489;0 0 0.76800000667572;0 0 0.772000014781952;0 0 0.776000022888184;0 0 0.779999971389771;0 0 0.783999979496002;0 0 0.787999987602234;0 0 0.791999995708466;0 0 0.796000003814697;0 0 0.800000011920929;0 0 0.804000020027161;0 0 0.808000028133392;0 0 0.811999976634979;0 0 0.815999984741211;0 0 0.819999992847443;0 0 0.824000000953674;0 0 0.828000009059906;0 0 0.832000017166138;0 0 0.836000025272369;0 0 0.839999973773956;0 0 0.843999981880188;0 0 0.84799998998642;0 0 0.851999998092651;0 0 0.856000006198883;0 0 0.860000014305115;0 0 0.864000022411346;0 0 0.867999970912933;0 0 0.871999979019165;0 0 0.875999987125397;0 0 0.879999995231628;0 0 0.88400000333786;0 0 0.888000011444092;0 0 0.892000019550323;0 0 0.896000027656555;0 0 0.899999976158142;0 0 0.903999984264374;0 0 0.907999992370605;0 0 0.912000000476837;0 0 0.916000008583069;0 0 0.920000016689301;0 0 0.924000024795532;0 0 0.927999973297119;0 0 0.931999981403351;0 0 0.935999989509583;0 0 0.939999997615814;0 0 0.944000005722046;0 0 0.948000013828278;0 0 0.952000021934509;0 0 0.955999970436096;0 0 0.959999978542328;0 0 0.96399998664856;0 0 0.967999994754791;0 0 0.972000002861023;0 0 0.976000010967255;0 0 0.980000019073486;0 0 0.984000027179718;0 0 0.987999975681305;0 0 0.991999983787537;0 0 0.995999991893768;0 0 1;0 0.00400000018998981 1;0 0.00800000037997961 1;0 0.0120000001043081 1;0 0.0160000007599592 1;0 0.0199999995529652 1;0 0.0240000002086163 1;0 0.0280000008642673 1;0 0.0320000015199184 1;0 0.0359999984502792 1;0 0.0399999991059303 1;0 0.0439999997615814 1;0 0.0480000004172325 1;0 0.0520000010728836 1;0 0.0560000017285347 1;0 0.0599999986588955 1;0 0.0640000030398369 1;0 0.068000003695488 1;0 0.0719999969005585 1;0 0.0759999975562096 1;0 0.0799999982118607 1;0 0.0839999988675117 1;0 0.0879999995231628 1;0 0.0920000001788139 1;0 0.096000000834465 1;0 0.100000001490116 1;0 0.104000002145767 1;0 0.108000002801418 1;0 0.112000003457069 1;0 0.11599999666214 1;0 0.119999997317791 1;0 0.123999997973442 1;0 0.128000006079674 1;0 0.131999999284744 1;0 0.136000007390976 1;0 0.140000000596046 1;0 0.143999993801117 1;0 0.148000001907349 1;0 0.151999995112419 1;0 0.156000003218651 1;0 0.159999996423721 1;0 0.164000004529953 1;0 0.167999997735023 1;0 0.172000005841255 1;0 0.175999999046326 1;0 0.180000007152557 1;0 0.184000000357628 1;0 0.187999993562698 1;0 0.19200000166893 1;0 0.195999994874001 1;0 0.200000002980232 1;0 0.203999996185303 1;0 0.208000004291534 1;0 0.211999997496605 1;0 0.216000005602837 1;0 0.219999998807907 1;0 0.224000006914139 1;0 0.228000000119209 1;0 0.23199999332428 1;0 0.236000001430511 1;0 0.239999994635582 1;0 0.244000002741814 1;0 0.247999995946884 1;0 0.252000004053116 1;0 0.256000012159348 1;0 0.259999990463257 1;0 0.263999998569489 1;0 0.26800000667572 1;0 0.272000014781952 1;0 0.275999993085861 1;0 0.280000001192093 1;0 0.284000009298325 1;0 0.287999987602234 1;0 0.291999995708466 1;0 0.296000003814697 1;0 0.300000011920929 1;0 0.303999990224838 1;0 0.30799999833107 1;0 0.312000006437302 1;0 0.316000014543533 1;0 0.319999992847443 1;0 0.324000000953674 1;0 0.328000009059906 1;0 0.331999987363815 1;0 0.335999995470047 1;0 0.340000003576279 1;0 0.34400001168251 1;0 0.34799998998642 1;0 0.351999998092651 1;0 0.356000006198883 1;0 0.360000014305115 1;0 0.363999992609024 1;0 0.368000000715256 1;0 0.372000008821487 1;0 0.375999987125397 1;0 0.379999995231628 1;0 0.38400000333786 1;0 0.388000011444092 1;0 0.391999989748001 1;0 0.395999997854233 1;0 0.400000005960464 1;0 0.404000014066696 1;0 0.407999992370605 1;0 0.412000000476837 1;0 0.416000008583069 1;0 0.419999986886978 1;0 0.42399999499321 1;0 0.428000003099442 1;0 0.432000011205673 1;0 0.435999989509583 1;0 0.439999997615814 1;0 0.444000005722046 1;0 0.448000013828278 1;0 0.451999992132187 1;0 0.456000000238419 1;0 0.46000000834465 1;0 0.46399998664856 1;0 0.467999994754791 1;0 0.472000002861023 1;0 0.476000010967255 1;0 0.479999989271164 1;0 0.483999997377396 1;0 0.488000005483627 1;0 0.492000013589859 1;0 0.495999991893768 1;0 0.5 1;0 0.504000008106232 1;0 0.508000016212463 1;0 0.512000024318695 1;0 0.515999972820282 1;0 0.519999980926514 1;0 0.523999989032745 1;0 0.527999997138977 1;0 0.532000005245209 1;0 0.53600001335144 1;0 0.540000021457672 1;0 0.544000029563904 1;0 0.547999978065491 1;0 0.551999986171722 1;0 0.555999994277954 1;0 0.560000002384186 1;0 0.564000010490417 1;0 0.568000018596649 1;0 0.572000026702881 1;0 0.575999975204468 1;0 0.579999983310699 1;0 0.583999991416931 1;0 0.587999999523163 1;0 0.592000007629395 1;0 0.596000015735626 1;0 0.600000023841858 1;0 0.603999972343445 1;0 0.607999980449677 1;0 0.611999988555908 1;0 0.61599999666214 1;0 0.620000004768372 1;0 0.624000012874603 1;0 0.628000020980835 1;0 0.632000029087067 1;0 0.635999977588654 1;0 0.639999985694885 1;0 0.643999993801117 1;0 0.648000001907349 1;0 0.65200001001358 1;0 0.656000018119812 1;0 0.660000026226044 1;0 0.663999974727631 1;0 0.667999982833862 1;0 0.671999990940094 1;0 0.675999999046326 1;0 0.680000007152557 1;0 0.684000015258789 1;0 0.688000023365021 1;0 0.691999971866608 1;0 0.695999979972839 1;0 0.699999988079071 1;0 0.703999996185303 1;0 0.708000004291534 1;0 0.712000012397766 1;0 0.716000020503998 1;0 0.720000028610229 1;0 0.723999977111816 1;0 0.727999985218048 1;0 0.73199999332428 1;0 0.736000001430511 1;0 0.740000009536743 1;0 0.744000017642975 1;0 0.748000025749207 1;0 0.751999974250793 1;0 0.755999982357025 1;0 0.759999990463257 1;0 0.763999998569489 1;0 0.76800000667572 1;0 0.772000014781952 1;0 0.776000022888184 1;0 0.779999971389771 1;0 0.783999979496002 1;0 0.787999987602234 1;0 0.791999995708466 1;0 0.796000003814697 1;0 0.800000011920929 1;0 0.804000020027161 1;0 0.808000028133392 1;0 0.811999976634979 1;0 0.815999984741211 1;0 0.819999992847443 1;0 0.824000000953674 1;0 0.828000009059906 1;0 0.832000017166138 1;0 0.836000025272369 1;0 0.839999973773956 1;0 0.843999981880188 1;0 0.84799998998642 1;0 0.851999998092651 1;0 0.856000006198883 1;0 0.860000014305115 1;0 0.864000022411346 1;0 0.867999970912933 1;0 0.871999979019165 1;0 0.875999987125397 1;0 0.879999995231628 1;0 0.88400000333786 1;0 0.888000011444092 1;0 0.892000019550323 1;0 0.896000027656555 1;0 0.899999976158142 1;0 0.903999984264374 1;0 0.907999992370605 1;0 0.912000000476837 1;0 0.916000008583069 1;0 0.920000016689301 1;0 0.924000024795532 1;0 0.927999973297119 1;0 0.931999981403351 1;0 0.935999989509583 1;0 0.939999997615814 1;0 0.944000005722046 1;0 0.948000013828278 1;0 0.952000021934509 1;0 0.955999970436096 1;0 0.959999978542328 1;0 0.96399998664856 1;0 0.967999994754791 1;0 0.972000002861023 1;0 0.976000010967255 1;0 0.980000019073486 1;0 0.984000027179718 1;0 0.987999975681305 1;0 0.991999983787537 1;0 0.995999991893768 1;0 1 1;0.00400000018998981 1 0.995999991893768;0.00800000037997961 1 0.991999983787537;0.0120000001043081 1 0.987999975681305;0.0160000007599592 1 0.984000027179718;0.0199999995529652 1 0.980000019073486;0.0240000002086163 1 0.976000010967255;0.0280000008642673 1 0.972000002861023;0.0320000015199184 1 0.967999994754791;0.0359999984502792 1 0.96399998664856;0.0399999991059303 1 0.959999978542328;0.0439999997615814 1 0.955999970436096;0.0480000004172325 1 0.952000021934509;0.0520000010728836 1 0.948000013828278;0.0560000017285347 1 0.944000005722046;0.0599999986588955 1 0.939999997615814;0.0640000030398369 1 0.935999989509583;0.068000003695488 1 0.931999981403351;0.0719999969005585 1 0.927999973297119;0.0759999975562096 1 0.924000024795532;0.0799999982118607 1 0.920000016689301;0.0839999988675117 1 0.916000008583069;0.0879999995231628 1 0.912000000476837;0.0920000001788139 1 0.907999992370605;0.096000000834465 1 0.903999984264374;0.100000001490116 1 0.899999976158142;0.104000002145767 1 0.896000027656555;0.108000002801418 1 0.892000019550323;0.112000003457069 1 0.888000011444092;0.11599999666214 1 0.88400000333786;0.119999997317791 1 0.879999995231628;0.123999997973442 1 0.875999987125397;0.128000006079674 1 0.871999979019165;0.131999999284744 1 0.867999970912933;0.136000007390976 1 0.864000022411346;0.140000000596046 1 0.860000014305115;0.143999993801117 1 0.856000006198883;0.148000001907349 1 0.851999998092651;0.151999995112419 1 0.84799998998642;0.156000003218651 1 0.843999981880188;0.159999996423721 1 0.839999973773956;0.164000004529953 1 0.836000025272369;0.167999997735023 1 0.832000017166138;0.172000005841255 1 0.828000009059906;0.175999999046326 1 0.824000000953674;0.180000007152557 1 0.819999992847443;0.184000000357628 1 0.815999984741211;0.187999993562698 1 0.811999976634979;0.19200000166893 1 0.808000028133392;0.195999994874001 1 0.804000020027161;0.200000002980232 1 0.800000011920929;0.203999996185303 1 0.796000003814697;0.208000004291534 1 0.791999995708466;0.211999997496605 1 0.787999987602234;0.216000005602837 1 0.783999979496002;0.219999998807907 1 0.779999971389771;0.224000006914139 1 0.776000022888184;0.228000000119209 1 0.772000014781952;0.23199999332428 1 0.76800000667572;0.236000001430511 1 0.763999998569489;0.239999994635582 1 0.759999990463257;0.244000002741814 1 0.755999982357025;0.247999995946884 1 0.751999974250793;0.252000004053116 1 0.748000025749207;0.256000012159348 1 0.744000017642975;0.259999990463257 1 0.740000009536743;0.263999998569489 1 0.736000001430511;0.26800000667572 1 0.73199999332428;0.272000014781952 1 0.727999985218048;0.275999993085861 1 0.723999977111816;0.280000001192093 1 0.720000028610229;0.284000009298325 1 0.716000020503998;0.287999987602234 1 0.712000012397766;0.291999995708466 1 0.708000004291534;0.296000003814697 1 0.703999996185303;0.300000011920929 1 0.699999988079071;0.303999990224838 1 0.695999979972839;0.30799999833107 1 0.691999971866608;0.312000006437302 1 0.688000023365021;0.316000014543533 1 0.684000015258789;0.319999992847443 1 0.680000007152557;0.324000000953674 1 0.675999999046326;0.328000009059906 1 0.671999990940094;0.331999987363815 1 0.667999982833862;0.335999995470047 1 0.663999974727631;0.340000003576279 1 0.660000026226044;0.34400001168251 1 0.656000018119812;0.34799998998642 1 0.65200001001358;0.351999998092651 1 0.648000001907349;0.356000006198883 1 0.643999993801117;0.360000014305115 1 0.639999985694885;0.363999992609024 1 0.635999977588654;0.368000000715256 1 0.632000029087067;0.372000008821487 1 0.628000020980835;0.375999987125397 1 0.624000012874603;0.379999995231628 1 0.620000004768372;0.38400000333786 1 0.61599999666214;0.388000011444092 1 0.611999988555908;0.391999989748001 1 0.607999980449677;0.395999997854233 1 0.603999972343445;0.400000005960464 1 0.600000023841858;0.404000014066696 1 0.596000015735626;0.407999992370605 1 0.592000007629395;0.412000000476837 1 0.587999999523163;0.416000008583069 1 0.583999991416931;0.419999986886978 1 0.579999983310699;0.42399999499321 1 0.575999975204468;0.428000003099442 1 0.572000026702881;0.432000011205673 1 0.568000018596649;0.435999989509583 1 0.564000010490417;0.439999997615814 1 0.560000002384186;0.444000005722046 1 0.555999994277954;0.448000013828278 1 0.551999986171722;0.451999992132187 1 0.547999978065491;0.456000000238419 1 0.544000029563904;0.46000000834465 1 0.540000021457672;0.46399998664856 1 0.53600001335144;0.467999994754791 1 0.532000005245209;0.472000002861023 1 0.527999997138977;0.476000010967255 1 0.523999989032745;0.479999989271164 1 0.519999980926514;0.483999997377396 1 0.515999972820282;0.488000005483627 1 0.512000024318695;0.492000013589859 1 0.508000016212463;0.495999991893768 1 0.504000008106232;0.5 1 0.5;0.504000008106232 1 0.495999991893768;0.508000016212463 1 0.492000013589859;0.512000024318695 1 0.488000005483627;0.515999972820282 1 0.483999997377396;0.519999980926514 1 0.479999989271164;0.523999989032745 1 0.476000010967255;0.527999997138977 1 0.472000002861023;0.532000005245209 1 0.467999994754791;0.53600001335144 1 0.46399998664856;0.540000021457672 1 0.46000000834465;0.544000029563904 1 0.456000000238419;0.547999978065491 1 0.451999992132187;0.551999986171722 1 0.448000013828278;0.555999994277954 1 0.444000005722046;0.560000002384186 1 0.439999997615814;0.564000010490417 1 0.435999989509583;0.568000018596649 1 0.432000011205673;0.572000026702881 1 0.428000003099442;0.575999975204468 1 0.42399999499321;0.579999983310699 1 0.419999986886978;0.583999991416931 1 0.416000008583069;0.587999999523163 1 0.412000000476837;0.592000007629395 1 0.407999992370605;0.596000015735626 1 0.404000014066696;0.600000023841858 1 0.400000005960464;0.603999972343445 1 0.395999997854233;0.607999980449677 1 0.391999989748001;0.611999988555908 1 0.388000011444092;0.61599999666214 1 0.38400000333786;0.620000004768372 1 0.379999995231628;0.624000012874603 1 0.375999987125397;0.628000020980835 1 0.372000008821487;0.632000029087067 1 0.368000000715256;0.635999977588654 1 0.363999992609024;0.639999985694885 1 0.360000014305115;0.643999993801117 1 0.356000006198883;0.648000001907349 1 0.351999998092651;0.65200001001358 1 0.34799998998642;0.656000018119812 1 0.34400001168251;0.660000026226044 1 0.340000003576279;0.663999974727631 1 0.335999995470047;0.667999982833862 1 0.331999987363815;0.671999990940094 1 0.328000009059906;0.675999999046326 1 0.324000000953674;0.680000007152557 1 0.319999992847443;0.684000015258789 1 0.316000014543533;0.688000023365021 1 0.312000006437302;0.691999971866608 1 0.30799999833107;0.695999979972839 1 0.303999990224838;0.699999988079071 1 0.300000011920929;0.703999996185303 1 0.296000003814697;0.708000004291534 1 0.291999995708466;0.712000012397766 1 0.287999987602234;0.716000020503998 1 0.284000009298325;0.720000028610229 1 0.280000001192093;0.723999977111816 1 0.275999993085861;0.727999985218048 1 0.272000014781952;0.73199999332428 1 0.26800000667572;0.736000001430511 1 0.263999998569489;0.740000009536743 1 0.259999990463257;0.744000017642975 1 0.256000012159348;0.748000025749207 1 0.252000004053116;0.751999974250793 1 0.247999995946884;0.755999982357025 1 0.244000002741814;0.759999990463257 1 0.239999994635582;0.763999998569489 1 0.236000001430511;0.76800000667572 1 0.23199999332428;0.772000014781952 1 0.228000000119209;0.776000022888184 1 0.224000006914139;0.779999971389771 1 0.219999998807907;0.783999979496002 1 0.216000005602837;0.787999987602234 1 0.211999997496605;0.791999995708466 1 0.208000004291534;0.796000003814697 1 0.203999996185303;0.800000011920929 1 0.200000002980232;0.804000020027161 1 0.195999994874001;0.808000028133392 1 0.19200000166893;0.811999976634979 1 0.187999993562698;0.815999984741211 1 0.184000000357628;0.819999992847443 1 0.180000007152557;0.824000000953674 1 0.175999999046326;0.828000009059906 1 0.172000005841255;0.832000017166138 1 0.167999997735023;0.836000025272369 1 0.164000004529953;0.839999973773956 1 0.159999996423721;0.843999981880188 1 0.156000003218651;0.84799998998642 1 0.151999995112419;0.851999998092651 1 0.148000001907349;0.856000006198883 1 0.143999993801117;0.860000014305115 1 0.140000000596046;0.864000022411346 1 0.136000007390976;0.867999970912933 1 0.131999999284744;0.871999979019165 1 0.128000006079674;0.875999987125397 1 0.123999997973442;0.879999995231628 1 0.119999997317791;0.88400000333786 1 0.11599999666214;0.888000011444092 1 0.112000003457069;0.892000019550323 1 0.108000002801418;0.896000027656555 1 0.104000002145767;0.899999976158142 1 0.100000001490116;0.903999984264374 1 0.096000000834465;0.907999992370605 1 0.0920000001788139;0.912000000476837 1 0.0879999995231628;0.916000008583069 1 0.0839999988675117;0.920000016689301 1 0.0799999982118607;0.924000024795532 1 0.0759999975562096;0.927999973297119 1 0.0719999969005585;0.931999981403351 1 0.068000003695488;0.935999989509583 1 0.0640000030398369;0.939999997615814 1 0.0599999986588955;0.944000005722046 1 0.0560000017285347;0.948000013828278 1 0.0520000010728836;0.952000021934509 1 0.0480000004172325;0.955999970436096 1 0.0439999997615814;0.959999978542328 1 0.0399999991059303;0.96399998664856 1 0.0359999984502792;0.967999994754791 1 0.0320000015199184;0.972000002861023 1 0.0280000008642673;0.976000010967255 1 0.0240000002086163;0.980000019073486 1 0.0199999995529652;0.984000027179718 1 0.0160000007599592;0.987999975681305 1 0.0120000001043081;0.991999983787537 1 0.00800000037997961;0.995999991893768 1 0.00400000018998981;1 1 0;1 0.995999991893768 0;1 0.991999983787537 0;1 0.987999975681305 0;1 0.984000027179718 0;1 0.980000019073486 0;1 0.976000010967255 0;1 0.972000002861023 0;1 0.967999994754791 0;1 0.96399998664856 0;1 0.959999978542328 0;1 0.955999970436096 0;1 0.952000021934509 0;1 0.948000013828278 0;1 0.944000005722046 0;1 0.939999997615814 0;1 0.935999989509583 0;1 0.931999981403351 0;1 0.927999973297119 0;1 0.924000024795532 0;1 0.920000016689301 0;1 0.916000008583069 0;1 0.912000000476837 0;1 0.907999992370605 0;1 0.903999984264374 0;1 0.899999976158142 0;1 0.896000027656555 0;1 0.892000019550323 0;1 0.888000011444092 0;1 0.88400000333786 0;1 0.879999995231628 0;1 0.875999987125397 0;1 0.871999979019165 0;1 0.867999970912933 0;1 0.864000022411346 0;1 0.860000014305115 0;1 0.856000006198883 0;1 0.851999998092651 0;1 0.84799998998642 0;1 0.843999981880188 0;1 0.839999973773956 0;1 0.836000025272369 0;1 0.832000017166138 0;1 0.828000009059906 0;1 0.824000000953674 0;1 0.819999992847443 0;1 0.815999984741211 0;1 0.811999976634979 0;1 0.808000028133392 0;1 0.804000020027161 0;1 0.800000011920929 0;1 0.796000003814697 0;1 0.791999995708466 0;1 0.787999987602234 0;1 0.783999979496002 0;1 0.779999971389771 0;1 0.776000022888184 0;1 0.772000014781952 0;1 0.76800000667572 0;1 0.763999998569489 0;1 0.759999990463257 0;1 0.755999982357025 0;1 0.751999974250793 0;1 0.748000025749207 0;1 0.744000017642975 0;1 0.740000009536743 0;1 0.736000001430511 0;1 0.73199999332428 0;1 0.727999985218048 0;1 0.723999977111816 0;1 0.720000028610229 0;1 0.716000020503998 0;1 0.712000012397766 0;1 0.708000004291534 0;1 0.703999996185303 0;1 0.699999988079071 0;1 0.695999979972839 0;1 0.691999971866608 0;1 0.688000023365021 0;1 0.684000015258789 0;1 0.680000007152557 0;1 0.675999999046326 0;1 0.671999990940094 0;1 0.667999982833862 0;1 0.663999974727631 0;1 0.660000026226044 0;1 0.656000018119812 0;1 0.65200001001358 0;1 0.648000001907349 0;1 0.643999993801117 0;1 0.639999985694885 0;1 0.635999977588654 0;1 0.632000029087067 0;1 0.628000020980835 0;1 0.624000012874603 0;1 0.620000004768372 0;1 0.61599999666214 0;1 0.611999988555908 0;1 0.607999980449677 0;1 0.603999972343445 0;1 0.600000023841858 0;1 0.596000015735626 0;1 0.592000007629395 0;1 0.587999999523163 0;1 0.583999991416931 0;1 0.579999983310699 0;1 0.575999975204468 0;1 0.572000026702881 0;1 0.568000018596649 0;1 0.564000010490417 0;1 0.560000002384186 0;1 0.555999994277954 0;1 0.551999986171722 0;1 0.547999978065491 0;1 0.544000029563904 0;1 0.540000021457672 0;1 0.53600001335144 0;1 0.532000005245209 0;1 0.527999997138977 0;1 0.523999989032745 0;1 0.519999980926514 0;1 0.515999972820282 0;1 0.512000024318695 0;1 0.508000016212463 0;1 0.504000008106232 0;1 0.5 0;1 0.495999991893768 0;1 0.492000013589859 0;1 0.488000005483627 0;1 0.483999997377396 0;1 0.479999989271164 0;1 0.476000010967255 0;1 0.472000002861023 0;1 0.467999994754791 0;1 0.46399998664856 0;1 0.46000000834465 0;1 0.456000000238419 0;1 0.451999992132187 0;1 0.448000013828278 0;1 0.444000005722046 0;1 0.439999997615814 0;1 0.435999989509583 0;1 0.432000011205673 0;1 0.428000003099442 0;1 0.42399999499321 0;1 0.419999986886978 0;1 0.416000008583069 0;1 0.412000000476837 0;1 0.407999992370605 0;1 0.404000014066696 0;1 0.400000005960464 0;1 0.395999997854233 0;1 0.391999989748001 0;1 0.388000011444092 0;1 0.38400000333786 0;1 0.379999995231628 0;1 0.375999987125397 0;1 0.372000008821487 0;1 0.368000000715256 0;1 0.363999992609024 0;1 0.360000014305115 0;1 0.356000006198883 0;1 0.351999998092651 0;1 0.34799998998642 0;1 0.34400001168251 0;1 0.340000003576279 0;1 0.335999995470047 0;1 0.331999987363815 0;1 0.328000009059906 0;1 0.324000000953674 0;1 0.319999992847443 0;1 0.316000014543533 0;1 0.312000006437302 0;1 0.30799999833107 0;1 0.303999990224838 0;1 0.300000011920929 0;1 0.296000003814697 0;1 0.291999995708466 0;1 0.287999987602234 0;1 0.284000009298325 0;1 0.280000001192093 0;1 0.275999993085861 0;1 0.272000014781952 0;1 0.26800000667572 0;1 0.263999998569489 0;1 0.259999990463257 0;1 0.256000012159348 0;1 0.252000004053116 0;1 0.247999995946884 0;1 0.244000002741814 0;1 0.239999994635582 0;1 0.236000001430511 0;1 0.23199999332428 0;1 0.228000000119209 0;1 0.224000006914139 0;1 0.219999998807907 0;1 0.216000005602837 0;1 0.211999997496605 0;1 0.208000004291534 0;1 0.203999996185303 0;1 0.200000002980232 0;1 0.195999994874001 0;1 0.19200000166893 0;1 0.187999993562698 0;1 0.184000000357628 0;1 0.180000007152557 0;1 0.175999999046326 0;1 0.172000005841255 0;1 0.167999997735023 0;1 0.164000004529953 0;1 0.159999996423721 0;1 0.156000003218651 0;1 0.151999995112419 0;1 0.148000001907349 0;1 0.143999993801117 0;1 0.140000000596046 0;1 0.136000007390976 0;1 0.131999999284744 0;1 0.128000006079674 0;1 0.123999997973442 0;1 0.119999997317791 0;1 0.11599999666214 0;1 0.112000003457069 0;1 0.108000002801418 0;1 0.104000002145767 0;1 0.100000001490116 0;1 0.096000000834465 0;1 0.0920000001788139 0;1 0.0879999995231628 0;1 0.0839999988675117 0;1 0.0799999982118607 0;1 0.0759999975562096 0;1 0.0719999969005585 0;1 0.068000003695488 0;1 0.0640000030398369 0;1 0.0599999986588955 0;1 0.0560000017285347 0;1 0.0520000010728836 0;1 0.0480000004172325 0;1 0.0439999997615814 0;1 0.0399999991059303 0;1 0.0359999984502792 0;1 0.0320000015199184 0;1 0.0280000008642673 0;1 0.0240000002086163 0;1 0.0199999995529652 0;1 0.0160000007599592 0;1 0.0120000001043081 0;1 0.00800000037997961 0;1 0.00400000018998981 0;1 0 0;0.995999991893768 0 0;0.991999983787537 0 0;0.987999975681305 0 0;0.984000027179718 0 0;0.980000019073486 0 0;0.976000010967255 0 0;0.972000002861023 0 0;0.967999994754791 0 0;0.96399998664856 0 0;0.959999978542328 0 0;0.955999970436096 0 0;0.952000021934509 0 0;0.948000013828278 0 0;0.944000005722046 0 0;0.939999997615814 0 0;0.935999989509583 0 0;0.931999981403351 0 0;0.927999973297119 0 0;0.924000024795532 0 0;0.920000016689301 0 0;0.916000008583069 0 0;0.912000000476837 0 0;0.907999992370605 0 0;0.903999984264374 0 0;0.899999976158142 0 0;0.896000027656555 0 0;0.892000019550323 0 0;0.888000011444092 0 0;0.88400000333786 0 0;0.879999995231628 0 0;0.875999987125397 0 0;0.871999979019165 0 0;0.867999970912933 0 0;0.864000022411346 0 0;0.860000014305115 0 0;0.856000006198883 0 0;0.851999998092651 0 0;0.84799998998642 0 0;0.843999981880188 0 0;0.839999973773956 0 0;0.836000025272369 0 0;0.832000017166138 0 0;0.828000009059906 0 0;0.824000000953674 0 0;0.819999992847443 0 0;0.815999984741211 0 0;0.811999976634979 0 0;0.808000028133392 0 0;0.804000020027161 0 0;0.800000011920929 0 0;0.796000003814697 0 0;0.791999995708466 0 0;0.787999987602234 0 0;0.783999979496002 0 0;0.779999971389771 0 0;0.776000022888184 0 0;0.772000014781952 0 0;0.76800000667572 0 0;0.763999998569489 0 0;0.759999990463257 0 0;0.755999982357025 0 0;0.751999974250793 0 0;0.748000025749207 0 0;0.744000017642975 0 0;0.740000009536743 0 0;0.736000001430511 0 0;0.73199999332428 0 0;0.727999985218048 0 0;0.723999977111816 0 0;0.720000028610229 0 0;0.716000020503998 0 0;0.712000012397766 0 0;0.708000004291534 0 0;0.703999996185303 0 0;0.699999988079071 0 0;0.695999979972839 0 0;0.691999971866608 0 0;0.688000023365021 0 0;0.684000015258789 0 0;0.680000007152557 0 0;0.675999999046326 0 0;0.671999990940094 0 0;0.667999982833862 0 0;0.663999974727631 0 0;0.660000026226044 0 0;0.656000018119812 0 0;0.65200001001358 0 0;0.648000001907349 0 0;0.643999993801117 0 0;0.639999985694885 0 0;0.635999977588654 0 0;0.632000029087067 0 0;0.628000020980835 0 0;0.624000012874603 0 0;0.620000004768372 0 0;0.61599999666214 0 0;0.611999988555908 0 0;0.607999980449677 0 0;0.603999972343445 0 0;0.600000023841858 0 0;0.596000015735626 0 0;0.592000007629395 0 0;0.587999999523163 0 0;0.583999991416931 0 0;0.579999983310699 0 0;0.575999975204468 0 0;0.572000026702881 0 0;0.568000018596649 0 0;0.564000010490417 0 0;0.560000002384186 0 0;0.555999994277954 0 0;0.551999986171722 0 0;0.547999978065491 0 0;0.544000029563904 0 0;0.540000021457672 0 0;0.53600001335144 0 0;0.532000005245209 0 0;0.527999997138977 0 0;0.523999989032745 0 0;0.519999980926514 0 0;0.515999972820282 0 0;0.512000024318695 0 0;0.508000016212463 0 0;0.504000008106232 0 0;0.5 0 0];
fw = ffmpegWriter();
fw.ffmpeg = '/usr/local/bin/ffmpeg';
conc = mx_get_concentration(ptr);
fh = figure;
set(gcf,'Position',[0,0,800,600])
%
% subplot(2,3,1)
% hold;
% line(border(1,:), border(2,:));
% scatter(res(1,:), res(2,:));
% subplot(2,3,2)
% surf(conc);
% view(0,90)
% colorbar
% colormap(cmap)
% caxis([-1,10])
% fw.getFrame();
growth_curve = [];
pathway = [];
nt = 60*60;
for i = 1:nt
dt = 1; % time to update
dt_conc = .1; % dt for concentration / producer growth
dt_ct = .02; % dt for chemotaxis pathway
%
mx_update_simulation(ptr, dt, dt_conc, dt_ct);
res_old = res;
res = mx_get_cell_positions(ptr);
conc = mx_get_concentration(ptr);
% pathway = [pathway, mx_get_pathway_status(ptr, [0])];
growth_curve = [growth_curve, [i;mx_get_producer_conc(ptr)]];
clf
% subplot(1,3,1)
%
%
% hold off
% line(border(1,:), border(2,:));
% hold on
% scatter(res(1,:), res(2,:),20,'filled','k');
% % scatter(res(1:1), res(2,1), 20, 'filled', 'r');
% xlim([0,50]*scale)
% ylim([0,50]*scale)
% title(['locations at t=' num2str(dt*i)])
% axis square
% drawnow
% subplot(1,3,2)
hold off
set(gca,'FontSize',40)
set(gca,'LineWidth',2)
surf(conc');
shading flat
hold on
scatter3(res(1,:)/scale+1, res(2,:)/scale+1, 40*ones(1,size(res(1,:),2)),40,'filled','k');
view(0,90);
xlim([1,50])
ylim([1,50])
set(gca,'XTickLabel',{num2str(5),num2str(10),num2str(15),num2str(20),num2str(25)})
set(gca,'YTickLabel',{num2str(5),num2str(10),num2str(15),num2str(20),num2str(25)})
title(['locations at t=' num2str(dt*i)])
colorbar
colormap(cmap)
set(gca,'FontSize',40)
set(gca,'LineWidth',2)
caxis([-1,4])
axis square
box on
drawnow
% subplot(1,3,3)
% plot(dt*1:i,growth_curve(2,:),'k*-')
% xlabel('time')
% ylabel('cell density')
% set(gca,'YScale','log')
% xlim([0,nt*dt])
% subplot(2,4,4)
% plot(dt*1:i,pathway(1,:),'k*-')
% ylabel('0 conc')
%
% subplot(2,4,5)
% plot(dt*1:i,pathway(2,:),'k*-')
% ylabel('1 conc')
%
% subplot(2,4,6)
% plot(dt*1:i,pathway(3,:),'k*-')
% ylabel('2 conc')
% subplot(2,4,7)
% plot(dt*1:i,pathway(4,:),'k*-')
% ylabel('3 conc')
% subplot(2,4,8)
% plot(dt*1:i,pathway(5,:),'k*-')
% ylabel('4 conc')
fw.getFrame()
end
mx_dealloc_simulation(ptr);
fw.writeMovie('chemotaxis.mp4',30)