Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Problem 3 Matlab code:

fun=inline('0.68/(exp((-1524891/T^2)+7.33129-0.89143*log(168)))+0.32/(exp((1280557/T^2)+7.94986-0.96455*log(168)))-1','T');
T=fsolve(fun,600,optimset('Display','off'))
display('Dew point temperature')
fun=inline('0.68*(exp((-1524891/T^2)+7.33129-0.89143*log(168)))+0.32*(exp((1280557/T^2)+7.94986-0.96455*log(168)))-1','T');
T=fsolve(fun,600,optimset('Display','off'))
display('Temperature in which vapor mixture is completely condensed')
T =
719.9200
Dew point temperature
T =
705.7515
Temperature in which vapor mixture is completely condensed

Problem 6 Matlab code:


function y=num6(p)
x=p(1);
T=p(2);
f1=249.6-290*x-x*exp(14.1603-2948.78/(T-44.563));
f2=-49.6+290*x-(1-x)*exp(14.2515-3242.38/(T-47.1806));
y=f1^2+f2^2;
p=fminsearch('num6',[0.5,400])
p =
0.4268

392.5396

Problem 7 Matlab code:


fun=inline('(0.24*exp((-970688.6/511^2)+7.15059-(0.76984*log(P))+(6.90224/P)))
+0.76*exp((-1280557/511^2)+7.94986-(0.964550*log(P)))-1')
P=fsolve(fun,50)
fun =
Inline function:
fun(P) = (0.24*exp((-970688.6/511^2)+7.15059-(0.76984*log(P))
+(6.90224/P)))+0.76*exp((-1280557/511^2)+7.94986-(0.964550*log(P)))-1

Equation solved.
fsolve completed because the vector of function values is near zero
as measured by the default value of the function tolerance, and
the problem appears regular as measured by the gradient.
<stopping criteria details>

P =
38.8079

Problem 9 Matlab code:


fun=inline('0.1*exp(-970688.6/660^2+7.15059-0.76984*log(P)+6.90224/P)-1');
P(1)=fsolve(fun,10);
fun=inline('0.15*exp(-970688.6/660^2+7.15059-0.76984*log(P)+6.90224/P)-1');
P(2)=fsolve(fun,10);
fun=inline('0.2*exp(-970688.6/660^2+7.15059-0.76984*log(P)+6.90224/P)-1');
P(3)=fsolve(fun,10);
fun=inline('0.25*exp(-970688.6/660^2+7.15059-0.76984*log(P)+6.90224/P)-1');
P(4)=fsolve(fun,10);
fun=inline('0.3*exp(-970688.6/660^2+7.15059-0.76984*log(P)+6.90224/P)-1');
P(5)=fsolve(fun,10);
fun=inline('0.35*exp(-970688.6/660^2+7.15059-0.76984*log(P)+6.90224/P)-1');
P(6)=fsolve(fun,10);
fun=inline('0.4*exp(-970688.6/660^2+7.15059-0.76984*log(P)+6.90224/P)-1');
P(7)=fsolve(fun,10);
fun=inline('0.45*exp(-970688.6/660^2+7.15059-0.76984*log(P)+6.90224/P)-1');
P(8)=fsolve(fun,10);
fun=inline('0.5*exp(-970688.6/660^2+7.15059-0.76984*log(P)+6.90224/P)-1');
P(9)=fsolve(fun,10)
x=[0.1:0.05:0.5];
plot(x,P)
grid on
ylabel('Pressure, in Psia');xlabel('xp');,title('xp vs Pressure');

Results:
P=

Columns 1 through 6

38.0355 59.2007 82.4242 107.3954 133.8658 161.6688

Columns 7 through 9

190.6714 220.7786 251.8069

You might also like