Originally Posted by
MartinKeppler
Hi All,
Below there is some piece of a code for a problem I try to solve. Unfortunately, I am not sure about the red part of the code. Always get an error message in Matlab. Does anybody know where the problem lies? I believe that the "fzero" function in matlab may have problem to handle the f_evaldeltaHV (P,T,x) function which by itself are functions and contatain the iteration variable T (temperature).
V=F*VF; % Vapor stream in mol/s
L=F-V; % Liquid stream in in mol/s
P=1;
Tf=350; %Temperature of feed
T=250; % Guess temperature
% Tchange=1000
% while (abs(Tchange)>1e-5)
% HF=f_evaldeltaHV(P,Tf,z); %Enthalpy of Feed stream in [J/mol]
% HV=f_evaldeltaHV(P,T,y); %Enthalpy of Vapor stream in [J/mol]
% HL=f_evaldeltaHL(P,T,x); %Enthalpy of Liquid stream in [J/mol]
f_energy_balance=F*f_evaldeltaHV(P,Tf,z)+Q V*f_evaldeltaHV(P,T,y)-L*f_evaldeltaHL(P,T,x);
Tnew=fzero(f_energy_balance,T,[],F,Q,V,L,P,T,x,y,z,Tf);
Tchange=T-Tnew;
% if abs(Tchange)<1e-5
% break;
% end;
% T=Tnew
%end;
Cheers and many thanks in advance.
Martin