You are on page 1of 3

Matlab tut 4

1.
2.a
CH3OH(g) HCHO(g) + H2(g)

Stream variables 4
Temp 2
Extent of reaction 1
Q 1
MB 3
Q 1
Temp 1
EB 1
Conversion 1
Basis 1
DF 0

Stream 1 2 Total
MB - 3 3+1
EB - 1 1
Selected - N2H r,T
variables N2HCHO
N2M

Number of ind.eq =5
Cp CH3OH = 17

Cp HCHO =12

Cp H2 = 7

Tref =675o

Equations (function file)


function f = tut4a(x)
N2M=x(1); N2for=x(2); N2H=x(3);r=x(4);T2=x(5);
%material balance
f(1)=100-N2M-r;
f(2)=r-N2H;
f(3)=r-N2for;
%energy balance
f(4)= (r*(122.7+((7*(T2-672))+(12*(T2-675))-(17*(675-675)))))+
(N2H*7*(T2-675))+(N2for*12*(T2-675))+(N2M*17*(675-675))-(N2M*17*(675-
675));
%conversion
f(5)=100-N2M-(0.25*100);
end

Script file:
x0=10*ones(1,5);
x=fsolve (@(x)tut4a(x),x0);
T2=x(5);
fprintf('the value of temp in stream 2=%6.2f\n',T2)

Command window:

You might also like