function e = emfTtypes(T)
% emfTtypes  EMF of T type thermocouple as function of temperature; scalar version
%
% Synopsis:  e = emfTtypes(T)
%
% Input:  T = temperature, degrees C,  -200 <= T <= 400 C
%
% Output: e = thermocouple emf in Volts

% --- Assign constants based on value of T
if 0<=T && T<=400
	c = [-2.7512901673e-17  4.5479135290e-14  -3.0815758772e-11   1.0996880928e-8 ...
       -2.1882256846e-6   2.0618243404e-4    3.3292227880e-2   38.748106364  0];
elseif -270<=T && T<0
  c = [ 7.9795153927e-28  1.3945027062e-24  1.0795539270e-21  4.8768662286e-19 ...
        1.4251594779e-16  2.8213521925e-14  3.8493939883e-12  3.6071154205e-10 ...
        2.2651156593e-8   9.0138019559e-7   2.0032973554e-5   1.1844323105e-4 ...
        4.4194434347e-2  38.748106364  0];
else
  error(sprintf('T = %g value outside of range -270 <= T <= 400 C\n',T));
end
e = polyval(c,T)*1e-6;   %  compute emf and convert microvolts to volts
