Skip to content
MathWorks - Mobile View
  • Sign In to Your MathWorks AccountSign In to Your MathWorks Account
  • Access your MathWorks Account
    • My Account
    • My Community Profile
    • Link License
    • Sign Out
  • Products
  • Solutions
  • Academia
  • Support
  • Community
  • Events
  • Get MATLAB
MathWorks
  • Products
  • Solutions
  • Academia
  • Support
  • Community
  • Events
  • Get MATLAB
  • Sign In to Your MathWorks AccountSign In to Your MathWorks Account
  • Access your MathWorks Account
    • My Account
    • My Community Profile
    • Link License
    • Sign Out

Videos and Webinars

  • MathWorks
  • Videos
  • Videos Home
  • Search
  • Videos Home
  • Search
  • Contact sales
  • Trial software
5:43 Video length is 5:43.
  • Description
  • Full Transcript
  • Code and Resources

Understanding Wavelets, Part 3: An Example Application of the Discrete Wavelet Transform

From the series: Understanding Wavelets

This video outlines the steps involved in denoising a signal with the discrete wavelet transform using MATLAB®. Learn how this denoising technique compares with other denoising techniques.

In this video, we will discuss how to use MATLAB to denoise a signal using the discrete wavelet transform. Let us load a signal and plot it in MATLAB. There are two signals here: The first is the original signal, and the second one is the original signal with some noise added to it. Our goal here is to denoise the noisy signal using the discrete wavelet transform.

Soon you will see how easy it is to do this in MATLAB. Here is an overview of the steps involved in wavelet denoising:

1. Your first step is to obtain the approximation and the detail coefficients. Do this by performing a multilevel wavelet decomposition. Recall that the discrete wavelet transform splits up a signal into a low pass subband (also called the “approximation level”) and high pass subband (also called the “detail level”). You can decompose the approximation subband at multiple levels or scales for a fine scale analysis.

2. The second step is to analyze the details and identify a suitable thresholding technique. I will cover this later in the video.

3. The third step is to threshold the detail coefficients and reconstruct the signal. Let us first perform a multilevel wavelet decomposition using the function wavedec. We will use a sym6 wavelet and decompose the noisy signal down to five levels. The function outputs the fifth level approximation coefficients along with the detail coefficients from levels one through five. The first-level detail coefficients capture the high frequencies of the signal.

Most of the high frequency content comprises the noise present in the signal. However, part of the high frequency is made up of abrupt changes in the signal. There are times when these abrupt changes carry meaning, and you would want to retain this information while removing the noise. Let us take a closer look at the details subband. To extract the coefficients, you can use the detcoef function and plot the coefficients for each level. I am using a helper function to extract and plot the coefficients. What you are seeing here is the original signal, along with the details plotted for levels one through five. Notice that the activity reduces drastically as the scale or level increases. So, we will focus on the level one details and ignore the rest for now. Our aim here is to retain these sharp changes while getting rid of the noise. One way to do this is by scaling the detail coefficients by a threshold. There are four main techniques available in MATLAB to help you compute a threshold for the purpose of denoising. The universal threshold is the simplest to compute and is computed using this formula.

Manually computing the threshold for the other three denoising techniques is not as straightforward. Instead, you can use MATLAB for this, so that you can focus on using the threshold value without worrying about how it is computed. There are two ways of applying the threshold. There are two thresholding operations, soft thresholding and hard thresholding. In both cases, the coefficients with a magnitude less than the threshold are set to zero. The difference between these two thresholding operations lies in how they deal with coefficients that are greater in magnitude than the threshold. In the case of soft thresholding, the coefficients greater in magnitude than the threshold are shrunk towards zero by subtracting the threshold value from the coefficient value, whereas in hard thresholding, the coefficients greater in magnitude than the threshold are left unchanged. Coming back to our example, let us denoise our noisy signal using Sure Shrink with the soft thresholding technique. Soft thresholding is a good starting point if you are not sure which technique to choose.

The entire process of thresholding the coefficients and reconstructing the signal from the new coefficients can be done using a single function as shown here. The first parameter, f, is the noisy signal. The second parameter specifies the thresholding technique; in this case, Sure Shrink. s denotes soft thresholding, and the parameter sln indicates threshold rescaling using a single estimate of noise based on first-level coefficients. level indicates the wavelet decomposition level, and the last parameter specifies the wavelet, which is sym6 in this case. The function wden performs a multilevel decomposition of the input signal, computes and applies the threshold to the detail coefficients, reconstructs the signal with the new detail coefficients, and provides it as an output. Let us now use the plot command to compare the noisy signal with the denoised signal, which was the output of the previous step. Clearly, the denoised version has less noise.

You can also compare the performance of the denoising technique we discussed earlier with other denoising techniques such as Savitzky-Golay filtering or the moving average technique. You can see that the wavelet denoising method outperforms other denoising techniques. Therefore, the benefits of using wavelet techniques to denoise a signal are clear.

Download Code and Files

Download code

Related Products

  • Wavelet Toolbox

3 Ways to Speed Up Model Predictive Controllers

Read white paper

A Practical Guide to Deep Learning: From Data to Deployment

Read ebook

Bridging Wireless Communications Design and Testing with MATLAB

Read white paper

Deep Learning and Traditional Machine Learning: Choosing the Right Approach

Read ebook

Hardware-in-the-Loop Testing for Power Electronics Control Design

Read white paper

Predictive Maintenance with MATLAB

Read ebook

Electric Vehicle Modeling and Simulation - Architecture to Deployment : Webinar Series

Register for Free

How much do you know about power conversion control?

Start quiz
Related Information
Related Information
Download code

Feedback

Featured Product

Wavelet Toolbox

  • Request Trial
  • Get Pricing

Up Next:

Explore a practical application of using continuous wavelet transforms in this MATLAB Tech Talk by Kirthi Devleker.
4:58
Part 4: An Example application of Continuous Wavelet...
View full series (5 Videos)

Related Videos:

1:45
What Is Wavelet Toolbox?
3:02
Model a Discrete Event System, Part 4: Assigning Attributes
2:26
Model a Discrete Event System, Part 1: Overview
2:45
Model a Discrete Event System, Part 6: Attribute Function...
3:49
Model a Discrete Event System, Part 8: Resources

View more related videos

MathWorks - Domain Selector

Select a Web Site

Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .

  • Switzerland (English)
  • Switzerland (Deutsch)
  • Switzerland (Français)
  • 中国 (简体中文)
  • 中国 (English)

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.

Americas

  • América Latina (Español)
  • Canada (English)
  • United States (English)

Europe

  • Belgium (English)
  • Denmark (English)
  • Deutschland (Deutsch)
  • España (Español)
  • Finland (English)
  • France (Français)
  • Ireland (English)
  • Italia (Italiano)
  • Luxembourg (English)
  • Netherlands (English)
  • Norway (English)
  • Österreich (Deutsch)
  • Portugal (English)
  • Sweden (English)
  • Switzerland
    • Deutsch
    • English
    • Français
  • United Kingdom (English)

Asia Pacific

  • Australia (English)
  • India (English)
  • New Zealand (English)
  • 中国
    • 简体中文Chinese
    • English
  • 日本Japanese (日本語)
  • 한국Korean (한국어)

Contact your local office

  • Contact sales
  • Trial software

MathWorks

Accelerating the pace of engineering and science

MathWorks is the leading developer of mathematical computing software for engineers and scientists.

Discover…

Explore Products

  • MATLAB
  • Simulink
  • Student Software
  • Hardware Support
  • File Exchange

Try or Buy

  • Downloads
  • Trial Software
  • Contact Sales
  • Pricing and Licensing
  • How to Buy

Learn to Use

  • Documentation
  • Tutorials
  • Examples
  • Videos and Webinars
  • Training

Get Support

  • Installation Help
  • MATLAB Answers
  • Consulting
  • License Center
  • Contact Support

About MathWorks

  • Careers
  • Newsroom
  • Social Mission
  • Customer Stories
  • About MathWorks
  • Select a Web Site United States
  • Trust Center
  • Trademarks
  • Privacy Policy
  • Preventing Piracy
  • Application Status

© 1994-2022 The MathWorks, Inc.

  • Facebook
  • Twitter
  • Instagram
  • YouTube
  • LinkedIn
  • RSS

Join the conversation