% Bi250c Homework 4, Problem 2 Starter Code
% written by Emmanuel de los Santos

function chemotaxis

% Specify Initial Conditions
t_start = 0;
t_end  = 100;
Xm_initial = 
Xm_s_initial = 

% Run the numberical ODE Solver
[t,X] = ode45(@chemodynamics, [t_start t_end], [Xm_initial Xm_s_initial]);

%Plot the result
plot(t,X)
xlabel('Time')
ylabel('Concentration')
title('Concentration of X_m and X_m^* vs. Time')
legend('X_m','X_m^*')

end
function dx=chemodynamics(t,z)

% Enter Parameters Here
krR = 
L = 
kr = 
kbB = 
Kxm = 
dx=zeros(2,1);

% Define Xm as the first element and Xm* as the second element
Xm = z(1);
Xm_s = z(2);

if t>20,
    L = 2*L;
end

dx(1) = krR+ L*Xm_s - kr*Xm;
dx(2) = -kbB*(Xm_s/(Kxm + Xm_s)) - L*Xm_s + kr*Xm;

end