Matlab code for denoising and compression of time series data using Adaptive Piecewise Constant Approximation