%图解法确定精馏塔理论板层数
function fdistillation
%图解法确定理论板层数
clear,clc
%1.已知数据
xD = 0.986;%塔顶组成
xW = 0.0220%塔釜组成
xF = 0.53;%进料组成
R = 3.8;%回流比
q = 1.550;%进料热状况
vledata = [%汽液平衡数据
0 0.0296 0.0615 0.1106 0.1435 0.2580 0.3908 0.5318 0.66300.7574 0.8604 1.0
0 0.0823 0.1555 0.2660 0.3325 0.4950 0.6340 0.7470 0.82900.8790 0.9320 1.0];
%2 绘制平衡线
plot(vledata(1,:),vledata(2,:),'*')
hold on
p = polyfit(vledata(1,:),vledata(2,:),3);
x1 = [0.0 :0.01:1.0];
y1 = polyval(p,x1);
plot(x1,y1)
hold on
%3 绘制对角线
line([0.0,1.0],[0.0,1.0])
% 4 绘制精馏段操作线
fplot(@recope,[0 xD],[],[],'r',R,xD)
hold on
% 5 绘制进料线方程
fplot(@qline,[xF 1],[],[],'g',q,xF)
hold on
% 6 与进料线的交点
xc = fzero(@cross,0.5,optimset('fzero'),R,xD,q,xF);
yc = recope(xc,R,xD);
% 7 绘制提馏段操作线
line([xc,xW],[yc,xW],'Color','c')
% 8 绘制梯级
x0 = xD;
y0 = xD;
n=0;
while 1
n = n+1;
[x0,y0] = tri(x0,y0,R ,xD,p ,xc ,yc,xW,n);
if x0<xW
break;
end
end
% 9修饰
s = sprintf('理论板数为%d',n);
text(0.1,0.9,s)
xlim([0,1]),ylim([0,1]),
title('图解法确定精馏塔理论板数'),
xlabel('x'),
ylabel('y')
%----精馏段操作线----
function y = recope(x,R,xD)
y = R*x/(R+1)+xD/(R+1);
%----进料线方程------
function y = qline(x,q,xF)
y = q*x/(q-1)-xF/(q-1);
%----交点------
function y = cross(x,R,xD,q,xF)
y = recope(x,R,xD)-qline(x,q,xF);
%-----平衡关系逆运算----
function y = vlei(x,p,yn)
y = polyval(p,x)-yn;
%-----绘制梯级------
function [x,y] = tri(x0,y0,R,xD,p,xc,yc,xW,n)
x = fzero(@vlei,x0,optimset('fzero'),p,y0);
if x>xc
y = recope(x,R,xD);
else
y = yc + (yc-xW)*(x-xc)/(xc-xW);
end
line ([x0,x,x],[y0,y0,y],'Color','m'),
text(x,y0,int2str(n),'VerticalAlignment','bottom')
grid on
说的第25行错了 渣渣看不出来啊
function fdistillation
%图解法确定理论板层数
clear,clc
%1.已知数据
xD = 0.986;%塔顶组成
xW = 0.0220%塔釜组成
xF = 0.53;%进料组成
R = 3.8;%回流比
q = 1.550;%进料热状况
vledata = [%汽液平衡数据
0 0.0296 0.0615 0.1106 0.1435 0.2580 0.3908 0.5318 0.66300.7574 0.8604 1.0
0 0.0823 0.1555 0.2660 0.3325 0.4950 0.6340 0.7470 0.82900.8790 0.9320 1.0];
%2 绘制平衡线
plot(vledata(1,:),vledata(2,:),'*')
hold on
p = polyfit(vledata(1,:),vledata(2,:),3);
x1 = [0.0 :0.01:1.0];
y1 = polyval(p,x1);
plot(x1,y1)
hold on
%3 绘制对角线
line([0.0,1.0],[0.0,1.0])
% 4 绘制精馏段操作线
fplot(@recope,[0 xD],[],[],'r',R,xD)
hold on
% 5 绘制进料线方程
fplot(@qline,[xF 1],[],[],'g',q,xF)
hold on
% 6 与进料线的交点
xc = fzero(@cross,0.5,optimset('fzero'),R,xD,q,xF);
yc = recope(xc,R,xD);
% 7 绘制提馏段操作线
line([xc,xW],[yc,xW],'Color','c')
% 8 绘制梯级
x0 = xD;
y0 = xD;
n=0;
while 1
n = n+1;
[x0,y0] = tri(x0,y0,R ,xD,p ,xc ,yc,xW,n);
if x0<xW
break;
end
end
% 9修饰
s = sprintf('理论板数为%d',n);
text(0.1,0.9,s)
xlim([0,1]),ylim([0,1]),
title('图解法确定精馏塔理论板数'),
xlabel('x'),
ylabel('y')
%----精馏段操作线----
function y = recope(x,R,xD)
y = R*x/(R+1)+xD/(R+1);
%----进料线方程------
function y = qline(x,q,xF)
y = q*x/(q-1)-xF/(q-1);
%----交点------
function y = cross(x,R,xD,q,xF)
y = recope(x,R,xD)-qline(x,q,xF);
%-----平衡关系逆运算----
function y = vlei(x,p,yn)
y = polyval(p,x)-yn;
%-----绘制梯级------
function [x,y] = tri(x0,y0,R,xD,p,xc,yc,xW,n)
x = fzero(@vlei,x0,optimset('fzero'),p,y0);
if x>xc
y = recope(x,R,xD);
else
y = yc + (yc-xW)*(x-xc)/(xc-xW);
end
line ([x0,x,x],[y0,y0,y],'Color','m'),
text(x,y0,int2str(n),'VerticalAlignment','bottom')
grid on
说的第25行错了 渣渣看不出来啊