%The function file

function dxdt = ODE_resources(t,x);

global a alphdot m; %declaring the global variables

x1 = x(1)   %[volume]
x2 = x(2)   %[x = Resource/Km]

dx1dt = a*((x2^m) / (1 + (x2^m)))*x1;
dx2dt = -(((alphdot)*a)*((x2^m) / (1 + (x2^m))))* x1;

dxdt = [dx1dt; dx2dt];

*************************************************************
% on a new M-file


clear all;

global a alphdot m;

a = 1.019;          %defining the constants

V_0 = 0.5;          %initial volume of bacteria

x_0 = 2.7;          %initial nutrient concentration

alphdot = 0.9;      %constant

m=1.2;              %Hill coefficient

%solve the ODE equations

resource = [];
out1=[];
out2=[];

%ODE solver
[t,x] = ode15s('ODE_resources',[0.01:0.1:7],[V_0; x_0]);
    


t=t+1.5;

hold on;
plot(t,x(:,1));      % plot v vs t

xlabel('time (hours)'); ylabel ('Growth of bacteria in volume');
title('Graph to show the growth of bacteria');
axis([0 7 0 7]);