function out=constant(x) %This function takes in an array of measurements and returns calculated %equilibrium constant for the gas phase reaction %The values of x are as follows: % %x(1); Water concentration %x(2); Nitrogen concentration %x(3); Nitrous oxide concentration %x(4); Hydrogen concentration water=x(:,1); nitrogen=x(:,2); noxide = x(:,3); hydrogen=x(:,4); %Let's calculate the equilibrium constant. %K = [N2]*[H2O]^2 / [NO]^2*[H2]^2 K = nitrogen.*water.^2./(noxide.^2.*hydrogen.^2); %Return the value of K out = K;