7 In a chemical engineering process water vapor H20 is heate
     7. In a chemical engineering process, water vapor (H20) is heated to sufficiently high temperatures that a significant portion of the water dissociates, or splits apart, to form oxygen (O2) and hydrogen (H2): If it is assumed that this is the only reaction involved, the mole fraction z of H20 that dissociates can be represented by r 2. 1 2 where K is the reactions equilibrium constant and pr is the total pressure of the mixture. If pr 3 atm and K 0.05, determine the value of that satisfies this equation. Hint: it is easiest to make this plot of the error between computed values (i e., f(r) value K) and then use fzero function to solve.  
  
  Solution
x=0.0282
MATLAB CODE:
clc;
 clear all;
 x0=0; % initial approximation for f(x)
 pt=3; % pressure
 K=0.05; %K
 f=@(x)((x/(1-x))*sqrt((2*pt)/(2+x))-K); % function
 x=fzero(f,x0); % x value =fzero(function,initial approximation)
 display(x);

