% 7.81/8.591/9.531
% Final Problem Set
% cAMP waves in Dictyostelium life cycle

clear; close;

dx=0.01;			% spatial resolution
x=(-1:dx:1);	% x grid
Lx=length(x);	% number of points
dt=0.01;			% time increment
tmax=100;		% maximum time
jrec=50;			% recording interval

% initial conditions
t=0;									% time
j=0;									% recording index

% initialize c and i here
c=;
i=;

while t<tmax;
   
   % plot every jrec cycles
   j=j+1;
   if(mod(j,jrec)==0)
    	plot(x,c,x,i);
    	axis([-1 1 0 1])
    	drawnow;
   end
   
   % take second derivative
   newc = [c(2) c c(Lx-1)];			% no flow boundary conditions
   c1=newc(1:Lx);
   c2=newc(2:Lx+1);
   c3=newc(3:Lx+2);
   ddc=(c1+c3-2*c2)/(dx*dx);			% second derivative of c
   
   dc=()*dt;	% dcdt
	di=()*dt;	% didt
   
   % update variables
   c=c+dc;
   i=i+di;
   t=t+dt;
   
end


