updated matlab functions