Info

This question is closed. Reopen it to edit or answer.

How can I run multiple bisect programs in one file?

1 view (last 30 days)
Aaron
Aaron on 7 Apr 2014
Closed: MATLAB Answer Bot on 20 Aug 2021
I have created bisection function files (five) and would like to combine them into one file to run. Below are the first 3.
File 1:
function f = enth2(T)
% For phi=0.2
HR=-249400; % Total enthalpy of reactants.
hO2 = 31.999*(1.507.*(T-298) - 33.54.*(sqrt(T)-sqrt(298)) + 111.1.*log(T/298));
hN2 = 28.013*(1.450.*(T-298) - 287.9.*log(T/298) + (5.35e4).*((1/298)-(1./T)));
hCO2 = 44.01*(1.540.*(T-298) - 245.1.*log(T/298) + (4.13e4).*((1/298)-(1./T)));
hH2O = 18.015*(4.613.*(T-298) - 206.6.*(sqrt(T)-sqrt(298)) + 967.5.*log(T/298));
HP = -6595306+11*(hH2O)+10*(hCO2)+62*(hO2)+291.4*(hN2);
f=HR-HP;
end
File 2:
function f = enth3(T)
% For phi=0.4.
HR=-249400; % Total enthalpy of reactants.
hO2 = 31.999*(1.507.*(T-298) - 33.54.*(sqrt(T)-sqrt(298)) + 111.1.*log(T/298));
hN2 = 28.013*(1.450.*(T-298) - 287.9.*log(T/298) + (5.35e4).*((1/298)-(1./T)));
hCO2 = 44.01*(1.540.*(T-298) - 245.1.*log(T/298) + (4.13e4).*((1/298)-(1./T)));
hH2O = 18.015*(4.613.*(T-298) - 206.6.*(sqrt(T)-sqrt(298)) + 967.5.*log(T/298));
HP = -6595306+11.*(hH2O)+10.*(hCO2)+23.25.*(hO2)+145.7.*(hN2);
f = HR-HP;
end
File 3:
function f = enth4(T)
% For phi=0.6
HR=-249400; % Total enthalpy of reactants.
hO2 = 31.999*(1.507.*(T-298) - 33.54.*(sqrt(T)-sqrt(298)) + 111.1.*log(T/298));
hN2 = 28.013*(1.450.*(T-298) - 287.9.*log(T/298) + (5.35e4).*((1/298)-(1./T)));
hCO2 = 44.01*(1.540.*(T-298) - 245.1.*log(T/298) + (4.13e4).*((1/298)-(1./T)));
hH2O = 18.015*(4.613.*(T-298) - 206.6.*(sqrt(T)-sqrt(298)) + 967.5.*log(T/298));
f=HR-(-6595306+11.*(hH2O)+10.*(hCO2)+10.33.*(hO2)+97.13.*(hN2));
end
  1 Comment
Jan
Jan on 7 Apr 2014
What do you want to achieve by this combination? We cannot guess this important detail.

Answers (0)

Community Treasure Hunt

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

Start Hunting!