realized BP algorithm with matlab