# OpenStax-CNX

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

### Recently Viewed

This feature requires Javascript to be enabled.

# DWT to compress a signal

Module by: Mark Eastaway. E-mail the author

Summary: Explains how the discrete wavelet transform can be used to compress a signal. Explains the use of the code r_compression.m

Module content for matlab program Wcompression.m

## Introduction:

Wcompression.m is a basic program that uses the wavelet transform to compress a signal using the wavelet transform. The following module will briefly describe how to use Wcompression.m to perform and to understand a compression wavelet method.

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

## How does wavelet compression work?

Compression in wavelet theory is very similar to de-noising. First, the wavelet transform is performed on the input signal. Second, the low coefficients are changed to zero. Then the coefficients are stored or transmitted without the zeros. Additionally, but not covered in this program, quantization and entropy encoding techniques, such as Huffman coding can be applied to the coefficients.

## How to use our code

To use our Wavelet compression code: after downloading our .m files, including the program OurDWT.m, type the following line in Matlab:

[reducedwsig, compressedsig] = R_compression(signal, compperc, plotoption)

Filling in your actual information for these inputs:

signal = signal input to be compressed

compperc = percentage of compression (0-100)

plotoption = option to plot, set equal to 1 to plot; all else will not plot

The outputs:

compressedsig = signal that has been compressed by DWT

reducedwsig = wavelet transform of compressed signal

## An Example:

Use the following lines of code in Matlab to see how this program works and visually see how wavelet compression works. We will create a signal, then compress the coefficients by 75% and show the results.

1. signal = sin(0:8*pi/100:8*pi-8*pi/100)
2. [reducedwsig, comrpessedsig] = R_compression(signal,75,1)

## Content actions

### Give feedback:

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