question plese help due tomorrow
3 次查看(过去 30 天)
显示 更早的评论
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
0 个评论
回答(1 个)
JESUS DAVID ARIZA ROYETH
2019-11-6
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 个评论
JESUS DAVID ARIZA ROYETH
2019-11-6
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
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!