verified and improved all programs with matlab