forked from andre-fu/igem-bioreactor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tank 3.m
39 lines (29 loc) · 778 Bytes
/
tank 3.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
%Tank 3, bioreactor
%%ODE solver for enzyme dynamics (iGEM, bioreactor)
%Initial concentration of PET
so = 5;
%%Initial conditions
y0 = [0, 0, 0]; %[s(0), c(0), p_1(0), c'(0), p_2(0)]
%%Time interval for solution
time = linspace(1,10, 100);
%%Solution
[t, y] = ode45(@f, time, y0);
%plot
plot(time, y(:, 1), '-s', time, y(:, 2), '-o', time, y(:, 3), '*')
legend('NH4OH', 'TPA', 'Diammonium Salt')
xlabel('Time')
ylabel('Concentration')
title('V = 15, NH4OH flux = 5, Tank 2 flux = 5, reaction rate = 15')
%%ODEs
function model = f(t,y)
%Variables in Andre's notes: y(1) = s, y(2) = c, y(3) = p_1, y(4) = c',
%y(5) = p_
V = 15;
B_in = 5;
L_in = 5;
k = 15;
model = zeros(3,1);
model(1) = B_in/V - k*y(2)*y(1);
model(2) = L_in/V - k*y(2)*y(1);
model(3) = k*y(2)*y(1);
end