clear all

t=24; 		% air temperature (C)
 tK=t+273.15; 	% air temperature (K)
p=101.8;	% air pressure (kPa);
U=40;		% relative humidity (%)
w = 3.654;	% weight of dried NaCl (g)

es=1.74e8 * exp(-5315.6/tK);	% saturation vapor pressure (kPa);
rhosample = 2.165;	% density of crystalline sodium chloride (g/cm^3)
gmol = 58.4428;		% g NaCl / mol NaCl
rhowt = 8.4;		% density of brass weights used to calibrate scale; 
% rhowt = 8.0;		% density of stainless weights; 

rhoair = 3.4848*(p-.0037960*U*es)*1e-3/(tK);
buoy_factor = (1-rhoair/rhowt)/(1-rhoair/rhosample);
m = w*buoy_factor;

disp(['Weight of sample (g): ' num2str(w)]);
disp(['Buoyancy-corrected mass of sample (g): ' num2str(m)]);
disp([' ']);
svol = .25;	% sample volume in liters
molarity = m/gmol/svol;
disp(['Molarity of ' num2str(svol) ' liters of solution : ' num2str(molarity) ' M (mol/l)']);


