Update GenerateBA.m

removed useless infinite loop...and added histogram...