{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Fall 2011 p 37 code up the differential equations

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: minutes, so we could recover 30% yield of each if desired. Fall 2011 p. 3/7 Code up the differential equations for reaction extents in Matlab: function dx=deriv2(t,x) global ratek A0; dx1=ratek(1)*(A0-x(1)-x(2)); dx2=ratek(2)*(A0-x(1)-x(2)); dx3=ratek(3)*(x(1)-x(3)); dx=[dx1;dx2;dx3]; end Now use an m ­file to integrate them and calculate the species concentrations from the reaction extents: global ratek A0 ratek=[.00201,.000501,.000134]; % rates in s^-1 A0=0.16; % use mM to avoid small values and numerical sensitivity issues trange=[0,60*40]; % interval calculated in s out to 40 min = 240 s x0=[0,0,0]; % all reaction extents start at 0.0 [t,xlist]=ode23(@deriv2,trange,x0); tmin=t/60; % choose to label plot axis in minutes x1=xlist(:,1); x2=xlist(:,2); x3=xlist(:,3); Asoln=A0-x1-x2; Bsoln=x1-x3; Csoln=x1+x2; Fall 2011 p. 4/7 Dsoln=x2+x3; plot(tmin,Asoln,'--',tmin,Bsoln,'-',tmin,Csoln,':', tmin,Dsoln, '.-') title('Salicylate esters') xlabel('time (min)') ylabel('concentration (mM)') legend('phenyl salicylate (feed)','...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online