how_homog

how_homog - clear; close; n=25; % number of discretized...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
clear; close; n=25; % number of discretized spatial points L=2; % spatial length dx=L/n; % incremental change in x coordinate dt=0.01; % incremental change in time T=50; % total integration time tplot=0.01; % plot frequency % constants D_D=0.28; D_E=0.6; s1=20; s1p=0.028; s2=0.0063; s3=0.04; s4=0.8; s4p=0.027; Dtot=1500; Etot=85; % initial conditions Dini=Dtot*rand; dini=Dtot-Dini; Eini=Etot*rand; eini=Etot-Eini; for x=1:n, Dold(x)=Dini; dold(x)=dini; Eold(x)=Eini; eold(x)=eini; end; % plot initial conditions xvec=linspace(0,1,n); subplot(2,2,1); plot(xvec,dold,'b'); ylabel('d'); subplot(2,2,2); plot(xvec,Dold,'g'); ylabel('D'); subplot(2,2,3); plot(xvec,eold,'r'); ylabel('e'); subplot(2,2,4); plot(xvec,Eold,'y'); ylabel('E'); drawnow; input('Hit a key to start simulation'); close; figure; % start of iterative time loop
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
for timestep=1:(T/dt); t=timestep*dt; % equation for internal points (from 2 to n-1) for x=2:n-1, dDdt(x)=-s1*Dold(x)/(1+s1p*eold(x))+s2*eold(x)*dold(x)+. .. D_D*(Dold(x-1)+Dold(x+1)-2*Dold(x))/dx^2;
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 11/11/2011 for the course BIO 7.344 taught by Professor Bobsauer during the Spring '08 term at MIT.

Page1 / 2

how_homog - clear; close; n=25; % number of discretized...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online