% test maxwell distribution 
% Milos Steinhart, Milky Way 13, 12. 10. 2009
mm=32;
tt= 300;
%vlim=[];      % v limit for dsiplay, if set empty vlim=3*vmax
vv=sqrt(8314*tt/mm);
vmax=vv*sqrt(2)
vmea=vv*sqrt(8/pi);
vrms=vv*sqrt(3);
vspe=[vmax vmea vrms];
if isempty(vlim) vlim=300*floor(vmax/100); end
vvv=[0:10:vlim];
mmm=maxwell0(mm,tt,vvv);
mspe=maxwell0(mm,tt,vspe);
plot(vvv,mmm)
hold on
plot([vmax,vmax],[0,mspe(1)],'c')
plot([vmea,vmea],[0,mspe(2)],'m')
plot([vrms,vrms],[0,mspe(3)],'r')
xlabel('V [m/s]');
legend('Maxwell','V-max','V-mean','V-rms');
title('Maxwell Distribution 300 and 600 K'); 