Chaohuang has a good answer, but I will also add that one other method that you can use would be via the Haar Wavelet Transform, followed by wavelet co-efficient shrinkage, and an Inverse Haar Transform back to the time-domain.
The Haar wavelet transform decomposes your signal into co-efficients of square and difference functions, albeit at different scales. The idea here is that you 'force' the new square signal representation to best match your original signal, and thus one that best represents where your edges lie.
When you perform a co-efficient shrinkage, all that means is that you are setting specific co-efficients of the Haar transformed function to zero. (There are other more involved methods, but that is the simplest). The Haar transformed wavelet co-efficients are scores associated with different square/difference functions at different scales. The RHS of the Haar transformed signal represents square/difference bases at the lowest scale, and thus, can be interpreted, at the 'highest frequency'. Most of the noise energy will thus lie here, VS most of the signal's energy that would lie on the LHS. Is is those bases co-efficients that are nulled out and the result then inverse transformed back to the time-domain.
Attached is an example of a sinusoid corrupted by heavy AWGN noise. The objective is to figure out where the 'start' and 'stop' of the pulse lie. Traditional filtering will smear the high-frequency (and highly localized in time) edges, since at its heart, filtering is an L-2 technique. In contrast, the following iterative process will denoise as well as preserve edges:
(I thought one could attach movies here, but I do not seem to be able to. You can download movie I made of the process here). (Right click and 'save link as').
I wrote the process 'by hand' in MATLAB, and it goes like this:
- Create a sinusoid pulse corrupted by heavy AWGN.
- Compute the envelope of the above. (The 'signal').
- Calculate the Haar Wavelet Transform of your signal at all scales.
- Denoise by iterative co-efficient thresholding.
- Inverse Haar Transform the shrunk co-efficient vector.
You can clearly see how the co-efficients are being shrunk, and the resulting Inverse Haar Transform resulting from it.
One drawback of this method however, is that the edges need to lie in or around the square/difference bases at a given scale. If not, the transform is forced to jump to the next higher level, and thus one loses an exact placement for the edge. There are multi-resolution methods used to counter act this, but they are more involved.