September 24, 2017, Sunday
University of Colorado at Boulder Search A to Z Campus Map University of Colorado at Boulder CU 
Search Links


Test.m

From MathBio

Jump to: navigation, search

Test.m

Test.m runs a series of loops to find the minimum value of leslie3.m. The birth rate that created that minimum value for the slope is used and plotted against the probability of the bacteria growing further from the wall or staying the same place.


A = zeros(1,100);
C = zeros(100);
max = 10;
for i = 0.01:0.01:1 %growth
  for j = 0.01:0.01:1 %stationary
      if i+j<=1
      for k = 0:0.1:2 %changing prob for slope = 0
          val = 1;
          if abs(leslie3(max,k,i,j))<val
              val = leslie3(max,k,i,j);
              num = k;
          end
      end
      for k = num-0.1:0.01:num+0.01 %narrowing range
          if abs(leslie3(max,k,i,j))<val
              val = leslie3(max,k,i,j);
              num = k;
          end
      end
      d = i*100;
      e = j*100;
      C(int64(d), int64(e)) = k;
      else
          d = i*100;
          e = j*100;
          C(int64(d),int64(e)) = 0;
      end
   end
end
i=0.01:0.01:1;
j=0.01:0.01:1;
surf(i,j,C)
title('Birth rates needed to sustain a population')
ylabel('Growth Probability')
xlabel('Stationary Probability')
zlabel('Birth Rate')