function demoSteamInterp
% demoSteamInterp  Create and evaluate an interpolant for enthalpy of steam

% --- Define the pressure, temperature and enthalpy data
p = [1; 1; 2; 2];                       %  MPa
T = [250; 500; 250; 500];               %  C
h = [2942.6; 3478.5; 2902.5; 3467.6];   %  kJ/kg

% --- Set up and solve the system of equations, and print the coefficients
[A,b] = steamSystem(p,T,h);
c = A\b;
fprintf('\n c = \n');  fprintf('  %18.8f\n',c);  fprintf('\n');

% --- Evaluate the interpolant
ptest = [1.25  1.25  1.75  1.75];
Ttest = [300   400   300   400];
htest = steamEnthalpy(ptest,Ttest,c);

fprintf('\n    p(i)     T(j)     h\n');
for i=1:length(ptest)
	fprintf('%8.2f  %6.0f  %8.1f\n',ptest(i), Ttest(i), htest(i));
end