A Time sequence segmentation implementation using Dynamic Programming in Matlab