some matlab scripts improvements