function [m,frac,sremax,lpeak]=bbody(t,lambda1,lambda2);
%
%  m=bbody(t,lambda1,lambda2);
%  m is Radiant Exitance in W/m^2
%  of a black body at temp t, kelvin
%  over wavelengths lambda1 to lambda2, microns
%
%  [m,frac,sremax,lpeak]=bbody(t,lambda1,lambda2);
%  frac is the ratio m divided by the radiant exitance from
%       zero to 100 microns
%  sremax is the maximum spectral radiance in the band
%         in W/m^2/micron
%  lpeak is the wavelength at which it occurs in microns
%
%  By Chuck DiMarzio
%  Northeastern University
%  2006
%
%  Rev 1.01 Feb 2007 to add comment
%
%  See also bbspec
%
dlambda=min(0.01,abs(lambda2-lambda1)/20);
lambda=[lambda1:dlambda:lambda2];
spec=bbspec(t,lambda);
m=sum(spec)*dlambda;
%
sremax=max(spec);
lpeak=lambda(find(spec==sremax));
% 
%
lambdafull=[dlambda:dlambda:1e2];
specfull=bbspec(t,lambdafull);
mfull=sum(specfull)*dlambda;
frac=m/mfull;
