% solve steam equilibrium problem
% with analytical Jacobian
clear;clc
% specify mass and volume of vapor
m = 3.755; % kg
V = 3.142; % m3
% initial estimates for pressure and temperature
x0 = [ 200000 110 ];
% create anonymous function to pass m and V
stmanon = @(x) SteamEq(x,m,V);
% set option for analytical Jacobian and to suppres display
options = optimoptions('fsolve','SpecifyObjectiveGradient',true ...
    ,'Display','none');
% call fsolve function to solve the equations
xsoln = fsolve(stmanon,x0,options);
% display the solution
fprintf('Pressure = %8.1f Pa\nTemperature = %6.2f degC\n',xsoln)

