Recovering a function with discontinuities from correlated data