Last active
October 2, 2020 15:06
-
-
Save numpde/5d9004d565b89e344761cd7696ef63aa to your computer and use it in GitHub Desktop.
SimBiology first script -- modified to index names of species
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 2020-HS Intro Bio Computers | |
% SimBiology first script -- modified to index names of species | |
% The trick | |
index_of = containers.Map(); | |
for i = 1 : length(BioComp_1.Species) | |
index_of(BioComp_1.Species(i).Name) = i; | |
end | |
clear AB; | |
A_index = 1; | |
for A = 0:0.5:10 | |
B_index = 1; | |
for B = 0:0.5:5 | |
BioComp_1.Species(index_of('A')).InitialAmount = A; | |
BioComp_1.Species(index_of('B')).InitialAmount = B; | |
[t, x] = sbiosimulate(BioComp_1); | |
AB(A_index, B_index) = x(end, 3); | |
B_index = B_index + 1; | |
end | |
A_index = A_index + 1; | |
end | |
figure; | |
surf(0:0.5:10, 0:0.5:5, AB'); | |
xlabel('A initial'); | |
ylabel('B initial'); | |
zlabel('AB equilibrium'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment