-
Notifications
You must be signed in to change notification settings - Fork 0
/
p_cme.txt
52 lines (41 loc) · 1.26 KB
/
p_cme.txt
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
This document 'p_cme.txt' explains the data saved in 'p_cme.bin'.
It is generated by matlab script "run_four_species_full_lattice" and it took 6 hours of compuational time. It contains a p_final vector that describes the probability of the system lands at each outcomes indexed by the 'state2ind' function.p_final vector is a 1679616 by 1 column vector. (36^4 = 1679616).
------config---------
x0 = [0; 0; 0; 35];
c = [1; 1.5; 1.2; 1.5];
T = 3;
-----------Matlab script-----------
x0 = [0; 0; 0; 35];
c = [1; 1.5; 1.2; 1.5];
nu1 = [-1; 1; 0; 0];
nu2 = [0; -1; 1; 0];
nu3 = [0; 0; -1; 1];
nu4 = [1; 0; 0; -1];
nu = [nu1, nu2, nu3, nu4];
base = sum(x0)+1;
num_node = base^4;
%global A_global
A = sparse(num_node, num_node);
ind_state = zeros(num_node, 4);
for i=1:num_node
x = ind2state(i,base);
A(i,i) = -sum(prop(x, c));
ind_state(i,:)=x';
for reac=1:4
x_in = x - nu(:,reac);
if prod (x_in>=0 & x_in<= sum(x0))
j = state2ind(x_in, base);
props = prop(x_in, c);
A(i,j)=props(reac);
end
end
end
%% run ODE
T = 3
tspan = [0, T];
index0 = state2ind(x0, base);
p0 = zeros(num_node, 1);
p0(index0) = 1;
[t, p] = ode23(@(t, p) four_species_cme_full_lattice(t, p, A), tspan, p0);
%%
p_final = p(end,:)';