-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgraph_all.m
104 lines (92 loc) · 2.96 KB
/
graph_all.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
function graph_all(config_filename)
close all;
%Read Config File:
configID = fopen(config_filename);
delta_space = str2double(fgetl(configID));
grid_width = str2double(fgetl(configID));
grid_height = str2double(fgetl(configID));
birth_rate_filename = fgetl(configID);
t_filename = fgetl(configID);
i_filename = fgetl(configID);
v_filename = fgetl(configID);
tissue_type_filename = fgetl(configID);
delta_t = fgetl(configID);
number_of_timesteps = fgetl(configID);
result_t_filename = fgetl(configID);
result_i_filename = fgetl(configID);
result_v_filename = fgetl(configID);
fclose(configID);
%make all 6 plots (T,I,V, and the same afterwards - you know this from
%the config file reading)
%Now we read in all the data
T_ID = fopen(t_filename);
T_ID
grid_width
grid_height
plot_T = fread(T_ID, [grid_width, grid_height], 'double');
fclose(T_ID);
I_ID = fopen(i_filename);
plot_I = fread(I_ID, [grid_width, grid_height], 'double');
fclose(I_ID);
V_ID = fopen(v_filename);
plot_V = fread(V_ID, [grid_width, grid_height], 'double');
fclose(V_ID);
result_T_ID = fopen(result_t_filename);
result_plot_T = fread(result_T_ID, [grid_width, grid_height], 'double');
fclose(result_T_ID);
result_I_ID = fopen(result_i_filename);
result_plot_I = fread(result_I_ID, [grid_width, grid_height], 'double');
fclose(result_I_ID);
result_V_ID = fopen(result_v_filename);
result_plot_V = fread(result_V_ID, [grid_width, grid_height], 'double');
fclose(result_V_ID);
%And now we plot:
y = linspace(0,grid_height * delta_space,grid_height);
x = linspace(0,grid_width * delta_space,grid_width);
%Scaling down the size for very large grids just so matlab doesn't cry
if (grid_height * grid_width > 10000)
plot_T = plot_T(1:10:end,1:10:end);
plot_I = plot_I(1:10:end,1:10:end);
plot_V = plot_V(1:10:end,1:10:end);
result_plot_T = result_plot_T(1:10:end,1:10:end);
result_plot_I = result_plot_I(1:10:end,1:10:end);
result_plot_V = result_plot_V(1:10:end,1:10:end);
x = x(1:10:end);
y = y(1:10:end);
end
subplot(2,3,1);
surf(x,y,plot_T.');
set(gca,'xlim',[0 grid_width]);
set(gca,'ylim',[0 grid_height]);
title('starting T population');
shading interp
subplot(2,3,2);
surf(x,y,plot_I.');
set(gca,'xlim',[0 grid_width]);
set(gca,'ylim',[0 grid_height]);
title('starting I population');
shading interp
subplot(2,3,3);
surf(x,y,plot_V.');
set(gca,'xlim',[0 grid_width]);
set(gca,'ylim',[0 grid_height]);
title('starting V population');
shading interp
subplot(2,3,4);
surf(x,y,result_plot_T.');
set(gca,'xlim',[0 grid_width]);
set(gca,'ylim',[0 grid_height]);
title('ending T population');
shading interp
subplot(2,3,5);
surf(x,y,result_plot_I.');
set(gca,'xlim',[0 grid_width]);
set(gca,'ylim',[0 grid_height]);
title('ending I population');
shading interp
subplot(2,3,6);
surf(x,y,result_plot_V.');
set(gca,'xlim',[0 grid_width]);
set(gca,'ylim',[0 grid_height]);
title('ending V population');
shading interp