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

In this video we will discuss how to use MATLAB to denoise the 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 Your first step is to obtain the approximation and the detail coefficients Do this by performing a multi-level wavelet decomposition Recall that the discrete wavelet transform
splits up a signal into a low-pass sub band also called as approximation level and the high-pass sub band also called as the detail level You can decompose the approximation sub band at multiple levels or scales for a fine scale analysis The second step is to analyze the details and identify a suitable thresholding technique I will cover this later in the video The third step is to threshold the detail coefficients and reconstruct the signal Let us first perform a multi-level wavelet decomposition using the function wave deck We will use the same six 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 captures the high frequencies of the signal Most of the high frequency content is comprised of the noise present in the signal However, part of the high frequency component 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 detail sub band To extract the coefficients you can use the Det Co F 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 1 through 5 Notice that the activity in the details reduces drastically as the scale or the level increases So we will focus on the level 1 details and ignore the rest for now Our aim here is to retain the 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 the threshold 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 thresholding operations soft thresholding and hard thresholding In both cases the coefficients with 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 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 the first level coefficients “level” indicates the wavelet decomposition level and the last parameter specifies the wavelet which is Simsek in this case The function “wden” performs a multi level decomposition of the input signal computes and applies the threshold to
the detail coefficients reconstruct 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 savitsky Goulet filtering or the moving average technique You can see that the wavelet denoising method outperforms other denoising techniques In this way the benefits of using wavelet techniques to denoise a signal are clear

## 25 thoughts on “Understanding Wavelets, Part 3: An Example Application of the Discrete Wavelet Transform”

1. eng.hamza al-mushet says:

thank you mathworks , i did watched all your tech talks,bode,state machinse and wavelets , they were great and helpful , we need more tech talks ,thank you again ðŸ™‚ ðŸ™‚

Great! Thank you so much!

3. Vishnu Chaudhary says:

has anyone punished you ,sir?? get some energy .

4. Tashanna Mss says:

I started learning the MATLAB on udemy, here is a -74% coupon to the LEARN MATLAB course:
https://www.udemy.com/learn-matlab/?couponCode=2016ML25

5. Juan Pablo Garcia Vazquez says:

Hi, where i can get the files????

6. Salsabil Zaghdoudi says:

Hello sir, I want to creat a function "dwt" that I am going to use for speech recognition and then apply it later on multiple speakers to extract the approximation coefficients; can you give me some instructions to do it ?

7. vamsikrishna srirangam says:

Good content, but cant watch video due to the emotionless person :/ why so serious ? :/ ðŸ˜›

8. Romina MartÃ­nez says:

excellent explanation !

9. Robert Lugg says:

Thank you. These videos make me wish I was smarter.

10. Vassilis Dimacopoulos says:

here is the source code for PlotDetCoefHelper
http://bit.ly/2EGtH6q

11. Ike Chukwu says:

Hi, I really enjoyed your training, when i just decompose and compose an audio file using wavelet without applying any threshold the new audio file have much noise in it why?

12. JoÃ£o Wiciuk says:

Great video, but I don't think wavelet denoising outperforms moving average denoising, at least for what was shown in the figures

13. Luan Rodrigues says:

Hi, do anyone knows how to reconstruct the signal with the new coefficients?

14. Sankavi V R says:

How to give in MRA input using simulink

15. ×§×¨×Ÿ ×’× ×¨ says:

your lectures on wavelets was life saving!. keep doing this amazing work to help engeneering student all around the world.

16. Sabbir Ahmed Shibli says:

He is a robot of blinking eyes -_- btw, thanks for the great support!

17. Hume Dickie says:

18. Ali Raza says:

He laughed a bit at the end.

19. Rinya C V says:

sir i need that code will you please send

20. Y.C S says:

what equipments you used for recording and making of the video?

21. Shekhar Singh says:

thnks for ur video sir…could u plz tell the what is the meaning of db1 db2 db3(Practical as well as theoretical meaning), or what is the difference between db1, db2 or db3 etc…â€¦â€¦â€¦..????????

22. Antonio Elua says:

the mooving average looks pretty clean