function f=smoker(xb,Ns,alpha,xd,R,zf,q) % This function uses analytical solution for binary system % For a given Ns, it solves for xb using "fzero" or "fsolve" % alpha - relative volatility % R - reflux ratio % xd - distillate comp. mole fraction % xb - bottom comp. mole fraction % zf - feed composition % q - feed thermal condition %E.g. opt=optimset('Display','Iter') %e.g. fsolve('ass6_2b',0.04,opt,6,3.8,.98,1.7113,.45,.55) % Solve for (xi,yi) and store in vector xi a(1,1) = R/(R+1); a(1,2) = -1; b(1) = -xd/(R+1); a(2,1) = q/(q-1); a(2,2) = -1; b(2) = zf/(q-1); xi=a\b'; % Striping section m=(R*zf+q*xd-(R+q)*xb)/((R+1)*zf+(q-1)*xd-(R+q)*xb); b= (1-m)*xb; % Compute coefficients of quadratic. c(1) = m*(alpha-1); c(2) = m + b*(alpha-1) -alpha; c(3) = b; % Determine the roots K1, K2 and number of trays temp = roots(c); K1 =min(temp); K2=max(temp); f = Ns-log(((xi(1)-K1)/(xb-K1))*((K2-xb)/(K2-xi(1))))/ ... log((1+(alpha-1)*K2)/(1+(alpha-1)*K1));