added bezier curve stuff for matlab