clear ; clc
FeedH2 = 450;
FeedCO2 = 50;
FeedH2O = 1150;
FeedCO = 500;
T = 500:25:1500;
n = length(T);
for i = 1:n
    fanon = @(x) fx(x,T(i),FeedH2,FeedCO2,FeedH2O,FeedCO)
    xsoln(i) = bisect1(fanon,50,450);
    ProdH2(i) = FeedH2 + xsoln(i);
    ProdCO2(i) = FeedCO2 + xsoln(i);
    ProdH2O(i) = FeedH2O - xsoln(i);
    ProdCO(i) = FeedCO - xsoln(i);
end
plot(T,ProdH2,'c',T,ProdCO2,'g',T,ProdH2O,'b',T,ProdCO,'m')
grid
xlabel('Temperature - degC')
ylabel('Flow Rate - kmol/h')
title('Water-Gas Shift Equilibrium')
legend('H2','CO2','H2O','CO','Location','eastoutside')
