# Connexions

You are here: Home » Content » DWT to denoise a signal

### Recently Viewed

This feature requires Javascript to be enabled.

# DWT to denoise a signal

Module by: Mark Eastaway. E-mail the author

Summary: Explains how to use the discrete wavelet transform to denoise a noisy signal.

Module content for Matlab program R_denoise.m

## Introduction:

R_denoise.m is a basic program that uses the wavelet transform to de-noise a signal through a technique called thresholding. The following module will briefly describe how to use R_denoise.m to perform and to understand the wavelet de-noising technique.

For some background on how the Discrete Wavelet Transform (DWT) works, click here.

Here is an example of the results of R_denoise.m:

## How does threshold de-noising work?

Threshold de-noising by wavelet transform is very similar to the method that our ears take to de-noise a music signal. We concentrate on the high peaks and try to ignore the low crackling of the white noise. Because DWT coefficients are based on amplitude and location of the signal, we can separate much of the noise from the signal relatively easily.

The DWT will transform a signal into a set of coefficients. The goal, as with most transforms is that these coefficients will be relatively sparse, containing most of the energy into a few peaks. When white noise is introduced into the signal, however, the noise’s wavelet transform will be spread out evenly among the coefficients. The technique of de-noising by thresholding takes the DWT of the signal plus noise, and throws out (makes them zero) coefficients below a certain threshold, leaving the peaks of the signal plus the noise on the peaks. The de-noising has eliminated the places in the signal where only noise exists.

As you can see by the following plots, there is as much noise content in the low amplitude part of the mixed signal as there is in the peaks. Therefore, by eliminating low coefficients, you can cut out noise while retaining the majority of the desired signal.

There are two types of thresholding, soft or hard, shown in the following code for R_denoise.m. The soft thresholding option in the code is on the top and circled in the blue rectangle; the hard thresholding option in the code is on the bottom and circled in the red rectangle.

Soft thresholding allows for the signal to retain more of its smoothness, whereas hard thresholding will allow for greater noise reduction. The following picture shows the results of soft vs. hard thresholding.

## How to use our code

To use our Wavelet De-noising code: after downloading our .m files, including the program R_DWT.m, type the following line in Matlab:

denoisedsig = R_denoise(signal, t,sh)

Filling in your actual information for these inputs:

signal = signal input to be denoised

t = threshold to de-noise below, this number may be changed around to achieve better denoising.

sh = option to do soft or hard thresholding (sh = 0 for soft, sh = 1 for hard)

The output, denoisedsig, will be a signal that has been de-noised by wavelet thresholding

## An Example:

Use the following lines in Matlab as an example to see how this program works and visually see how wavelet de-noising by thresholding works. We will create a pure signal, then add noise, then de-noise by hard thresholding using R_denoise.m.

1. puresignal = sin(0:8*pi/100:8*pi-8*pi/100);
2. figure(1);
3. plot(puresignal)
4. title('Pure Signal')
5. noise = .1*randn(1,100);
6. figure(2);
7. plot(noise)
8. title(‘Noise’)
9. signal = puresignal + noise;
10. figure(3);
11. plot(signal)
12. title(‘Noisy Input Signal’)
13. denoisedsignal = R_denoise(signal,.1,1);
14. figure(4)
15. plot(denoisedsignal)
16. title(‘De-noised Signal’)

## Content actions

PDF | EPUB (?)

### What is an EPUB file?

EPUB is an electronic book format that can be read on a variety of mobile devices.

My Favorites (?)

'My Favorites' is a special kind of lens which you can use to bookmark modules and collections. 'My Favorites' can only be seen by you, and collections saved in 'My Favorites' can remember the last module you were on. You need an account to use 'My Favorites'.

| A lens I own (?)

#### Definition of a lens

##### Lenses

A lens is a custom view of the content in the repository. You can think of it as a fancy kind of list that will let you see content through the eyes of organizations and people you trust.

##### What is in a lens?

Lens makers point to materials (modules and collections), creating a guide that includes their own comments and descriptive tags about the content.

##### Who can create a lens?

Any individual member, a community, or a respected organization.

##### What are tags?

Tags are descriptors added by lens makers to help label content, attaching a vocabulary that is meaningful in the context of the lens.

| External bookmarks