Gibbs phenomenon removal by adding Heaviside functions