question plese help due tomorrow

5 views (last 30 days)
i need to solve the following question without syms and using numerical solution:
question)
Consider a system for heating a liquid benzene/toluene solution to distil a pure benzene vapour. A particular batch distillation unit is charged initially with 100 mol of a 60 percent mol benzene/40 percent mol toluene mixture. Let ? (mol) be the amount of liquid remaining in the still, and let ? (mol B/mol) be the benzene mole fraction in the remaining liquid. Conservation of mass for benzene and toluene can be applied to derive the following relation [Felder, 1986]. ? = 100 ( ? 0.6 ) 0.625 ( 1 − ? 0.4 ) −1.625 Determine what mole fraction of benzene remains when ? = 70[mol]. Please present both numerical and graphical solutions. Both results and show the percentage error of graphical solution shall be presented by using disp or fprintf function.
my code)
%% Q5)
clear;clc;
syms x
EquationL=70==100*((x/0.6)^0.625)*((1-x)/0.4)^(-1.625); %Formula for 'L', (L=70)
SolutionX=double(solve(EquationL,x)); %solving to find value of 'x'
SolutionX=SolutionX(1)
fplot((100*((x/0.6)^0.625)*((1-x)/0.4)^(-1.625)),[0 0.6])
grid on
title('L vs x')
xlabel('x[mol B/mol]') %Label for x axis on graph
ylabel('x [mol]') %Label for y axix on graph
[xgraph,L]=ginput(1);
xgraph
error=abs((SolutionX-xgraph)/SolutionX)*100;
fprintf('Percentage error: %f\n\n',error) %'Percentage error' for graph

Answers (1)

JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH on 6 Nov 2019
here the Solution:
clear;clc;
fun=@(x) 100*((x/0.6).^0.625).*((1-x)/0.4).^(-1.625)-70; %Formula for 'L', (L=70)
SolutionX=fsolve(fun,0) %solving to find value of 'x'
plot(0:0.01:0.6,fun(0:0.01:0.6)+70)
grid on
title('L vs x')
xlabel('x[mol B/mol]') %Label for x axis on graph
ylabel('x [mol]') %Label for y axix on graph
[xgraph,L]=ginput(1);
xgraph
error=abs((SolutionX-xgraph)/SolutionX)*100;
fprintf('Percentage error: %f\n\n',error) %'Percentage error' for graph
  2 Comments
Yusuf Muhammad Khan
Yusuf Muhammad Khan on 6 Nov 2019
thanks a lot for helping, only issue is ur answer comes up with this error:
Undefined function 'fsolve' for input arguments of type 'function_handle'.
Error in untitled23 (line 3)
SolutionX=fsolve(fun,0) %solving to find value of 'x'
JESUS DAVID ARIZA ROYETH
JESUS DAVID ARIZA ROYETH on 6 Nov 2019
it seems that you do not have the optimization package, therefore the solution could be to implement a numerical method, here I leave one
clear;clc;
fun=@(x) 100*((x/0.6).^0.625).*((1-x)/0.4).^(-1.625)-70; %Formula for 'L', (L=70)
a=0.01;
b=0.99;
SolutionX=(a+b)/2;
fz=fun(SolutionX);
while abs(fz)>1e-6
if fz<0
a=SolutionX;
else
b=SolutionX;
end
SolutionX=(a+b)/2;
fz=fun(SolutionX);
end
SolutionX
plot(0:0.01:0.6,fun(0:0.01:0.6)+70)
grid on
title('L vs x')
xlabel('x[mol B/mol]') %Label for x axis on graph
ylabel('x [mol]') %Label for y axix on graph
[xgraph,L]=ginput(1);
xgraph
error=abs((fz-xgraph)/fz)*100;
fprintf('Percentage error: %f\n\n',error) %'Percentage error' for graph

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!