function vf=boltvfcn(v) %----------------------------------------------------------------------- % Return the m-th moment of the Maxwell-Boltzmann distribution function % f(v)=4*pi*(xm/2/pi/xk/T)^1.5 * exp(-xm*v*v/2/xk/T)*v*v % Given % v = Speed (m/sec) % xm = Mass of molecule = 32 g/mole for oxygen % xk = Boltzmann (gas) constant = 8.319 Joule/mole-K % T = Temperature (K) % moment = m-th moment % Note: for moment=0, the integral of vf from 0 to infinity should be unity. % moment=1, the integral gives the mean speed. % moment=2, the squared root of the integral gives the root-mean speed. %----------------------------------------------------------------------- % Programming Note: % The integrand function must return a vector when the input v is a vector. % This is because MATLAB evaluates this function at many points of v; it % throws into this function a whole vector v (not just a scalar). %----------------------------------------------------------------------- global xm global T moment % Some constants % pi = 3.141593; xk = 8.319; % Joule/mole-K % Calculate the distribution function f = 4*pi*(xm/2/pi/xk/T)^1.5 * exp(-xm*v.*v/2/xk/T).*v.*v; vf = v.^moment.*f;