add function mean_inBins

compute the mean within each bin and replace the values in that bin with
the mean value
piecewise averaging function mean_piecewise

compute mean in the specified pieces and shortened the signal.
add function mean_piecewise