HW7 Solution - CA = 1; % concentration mol/m3 DHrxn = 500;...

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

View Full Document Right Arrow Icon
HW7 Solution
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5

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

View Full DocumentRight Arrow Icon
Background image of page 6
Background image of page 7

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

View Full DocumentRight Arrow Icon
D. code % Plot for Part I T = [273:600]; nT = length(T); f = zeros(1,nT); for i = 1:nT f(i) = myfunhw7(T(i)); end plot(T,f) % False position xL = 300; xU = 600; ni = 10; xr = zeros(1,ni); fL = myfunhw7(xL); fU = myfunhw7(xU); for i = 1:ni [xL xU] [fL fU] %xM = (xL+xU)/2; Bisection xM = xU - fU*(xL-xU)/(fL-fU); fM = myfunhw7(xM); fM if (fL*fM < 0) % Sign change on left half xU = xM; fU = fM; else % Sign change on right half xL = xM; fL = fM; end end xM % Secant xim1 = 400; xi = 500; fim1 = myfunhw7(xim1); fi = myfunhw7(xi); ni = 10; for i = 1:ni xip1 = xi - fi*(xim1-xi)/(fim1-fi); fip1 = myfunhw7(xip1); % Transfer points for next iteration xim1 = xi; xi = xip1; fim1 = fi; fi = fip1; xi end xip1 function y = myfunhw7(x)
Background image of page 8
rho = 1000; % density kg/m3 cp = 4.184; % heat capacity kJ/kg-K F = 1; % volume flow rate m3/s T0 = 273; % inlet temperature K V = 1; % volume m3
Background image of page 9

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

View Full DocumentRight Arrow Icon
Background image of page 10
Background image of page 11
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: CA = 1; % concentration mol/m3 DHrxn = 500; % heat of reaction kJ/mol k0 = 20000; % reaction rate constant 1/s Ea = 10000; % activation energy for reaction J/mol R = 8.314; % gas constant J/K-mol y = F*rho*cp*(x-T0) - DHrxn*k0*exp(-Ea/R/x)*CA*V; F*rho*cp*(x-T0); DHrxn*k0*exp(-Ea/R/x)*CA*V; C. code % Part II Psat = [20; 180; 1200]; T = [-40; 0; 50]; ni = 20; x = zeros(3,ni); x(:,1) = [7; 1000; 200]; for i = 1:ni-1 fxi = [log10(Psat(1)) - x(1,i) + x(2,i)/(T(1)+x(3,i)); . .. log10(Psat(2)) - x(1,i) + x(2,i)/(T(2)+x(3,i)); . .. log10(Psat(3)) - x(1,i) + x(2,i)/(T(3)+x(3,i))]; Ji = [-1 1/(T(1)+x(3,i)) -x(2,i)/(T(1)+x(3,i))^2;. .. -1 1/(T(2)+x(3,i)) -x(2,i)/(T(2)+x(3,i))^2;. .. -1 1/(T(3)+x(3,i)) -x(2,i)/(T(3)+x(3,i))^2]; x(:,i+1) = x(:,i) - inv(Ji)*fxi; end % Check answer A = x(1,ni); B = x(2,ni); C = x(3,ni); for i = 1:3 [log10(Psat(i)) A - B/(T(i)+C)] end...
View Full Document

This note was uploaded on 05/10/2008 for the course CHBE 2120 taught by Professor Gallivan during the Summer '07 term at Georgia Institute of Technology.

Page1 / 11

HW7 Solution - CA = 1; % concentration mol/m3 DHrxn = 500;...

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

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