Thumbnail for The Wavelet transform explained by Srinath Srinivasan

The Wavelet transform explained

Srinath Srinivasan

16m 57s2,854 words~15 min read
Auto-Generated

[0:00]Hello everybody. Today we'll talk about wavelet transform. Now the wavelet transform is a type of time frequency analysis. The time frequency analysis analyze a non stationary signal and indicate both frequencies present in the signal and the time at which those frequencies occur. Now in contrast, the traditional forier transform works only for stationary signals of infinite length. And before we go deep into the wavelet transform, let's talk about the Forier transform. The Forier transform is based on the Forier theorem. The theorem states that any periodic signal can be represented as an infinite sum of sines and cosines. Now, basically what the FFT does is it converts the time domain data into the frequency domain data. Let's say, for example, if you have a time signal and you wish to understand what that signal is made up of, you simply perform an FFT, it gives you what frequencies are present in the signal. Now, before conversion, the time signal is windowed. So, windowing divides the signal into multiple blocks, which will later be averaged for the analysis. Now, there are two types of window. There is a wide window and there is a narrow window. Now, a wide window offers high frequency resolution but poor time resolution. Now, the frequencies along the Y-axis and the time is along the X-axis. In comparison, the narrow window offers high time resolution but poor frequency resolution. Now, this resolution idea will become clear when we actually look at the spectrum plots. But for now, let's understand that this is how a wide window is and narrow window is categorized. But the takeaway from here is that no matter what window type you choose, you always have a compromise. So, either you have a good frequency resolution or a good time resolution but not both. So, if you choose a wide window, you get high frequency resolution at the expense of the time resolution, and if you chose a narrow window, you get high time resolution at the expense of the frequency resolution. So, this is the drawback. Now, let's use the Fourier transform to analyze a door closed sound. Now, door closed sound is a short event. It's a typical candidate for wavelet analysis. But we're going to use, you know, the FFT analysis in this case so as to understand what happens, what would happen if you use, you know, if you perform FFT on a door closed sound, where will it fail? So, and later toward the end of the video, we will apply the wavelet transform and see the differences. So, this is a typical average door closed sound. You can hear it. So, now let's perform the 2D FFT spectrum. So, it's obvious that a sound that lasts so short in the time domain, it's an impulsive sound, is going to be pretty broad in the frequency domain, which is reflected here. But then we're missing out one important aspect here, which is the time, the time information. So, for that we need a third dimension here. So, we will view the same data in 3D. So, we're still in the FFT but we have information now about the frequency along the Y-axis, the time along the X-axis, and the color represents the amplitude. Now, in this case, we have high time resolution. So, based on our window, we have high time resolution, which means we know at what time the signal occurred. But we don't have good information about the frequency because as you know this is a trade-off. If you have high time resolution, you have poor frequency resolution. So, this is such a situation. The next situation is that we have very high frequency resolution. So, we know what frequencies are present, but we have very poor time resolution. So, it's like we know what frequencies are present for sure, but then we don't know at what time they're active. So, as you can see, it's pretty blurred. We can't really make out, you know, whether the the frequencies are present at 0.1 second or 0.2 second. And the same is true for here. Like, you know, we don't know what frequencies are present at at 0.1 second and 0.2 second.

[4:03]So, this is like the trade-off, so you have either high frequency resolution or high time resolution. If you try to get a compromise somewhere in between, you still get a blurred image and it's still not pretty clear what is present where. So, those are the limitations of FFT. The FFT doesn't represent abrupt changes efficiently. Now, typically a door closed sound is pretty abrupt, so it's not useful for that. And both the time and frequency resolutions are fixed, as you saw in the previous plots, you can either have a high frequency or a high time resolution. And there is always a compromise and still the plots are blurred. The FFT represents data as a sum of sine waves which are not localized in time or space. There are two more important points here. Now, a high frequency resolution is required since low frequency components last a long time. And a high time resolution is required because high frequency components last a short time. Now, these two points are very important in the wavelet analysis, where the FFT is failing, because the FFT is offering fixed resolution. And if you want high frequency and high time resolution at the same time, the FFT cannot deliver. That's where the wavelet comes into play. The wavelet transform overcomes the disadvantages of FFT by analyzing a signal with wavelets. So, it's a different technology altogether. We're using wavelets to do the operation. The wavelet transform, a multi resolution windowing is used to capture signals with good time and frequency resolution. As we observed earlier, with FFT, you have a narrow window or a wide window, which leads to a fixed time or frequency resolution. But in this case, we're, you know, we're using a multi resolution windowing so as to get good time and frequency resolution at the same time. The time and frequency resolution are no longer fixed but user defined. Due to multi resolution processing, it is possible to view frequency content with respect to time. So, why is the need for the wavelet transform? It is often required to know how a frequency content of a signal changes with respect to time. So, for example, our door close sound, we want to know how the frequency content changes in that small amount of time. So, FFT can capture the frequency variation with respect to time but compromises on either time or frequency resolution. As we saw in the plots earlier, we get either a good time resolution or a good frequency resolution but not both. And the plots look blurred anyway, so we really can't make sense of that. The wavelet transform achieves a good time and frequency resolution by using multiple wavelets. So, it's useful to analyze extremely short events such as automotive door closed sound with good time and frequency resolution, which we will analyze at the end of the video. So, this is the wavelet transform window. It's a multi resolution window to provide good time and frequency resolution. If you compare this with the standard FFT windows, just the wide or the narrow window, this is totally different. So, this doesn't compromise anything. It provides you good time and frequency resolution at the same time. And you see the construction here, so how it becomes narrower as it goes up, so that's for a reason. So, at low frequencies, the wavelet transform provides high frequency resolution but poor time resolution. So, you might be wondering when you hear the word poor, so is it a bad thing? But actually it's not a bad thing because low frequency sounds last a long time. So, if you have poor time resolution, it would it's still not a problem because it would not miss out to capture these waves. So, here, for example, is this, uh, you know, this is the lower end of this window, the low frequency, you have high frequency resolution but poor time resolution. Now, in contrast, at high frequencies, the wavelet transform provides high time resolution but poor frequency resolution. So, this is the high frequencies and you have high time resolution but poor frequency resolution. Again, the word poor is no longer a problem because high frequencies last a short time, and poor frequency resolution would not miss out to capture these waves. Now, it might seem a little confusing here with the word resolution being pronounced so many times, but then it'll become clear when you actually look at the analysis and I'll be overlaying this window to show you how it looks like. So, in order to perform a wavelet transform analysis, you need something called as a wavelet. Now, a wavelet is a wave-like oscillation with an amplitude that begins at zero, increases or decreases and then returns to zero one or more times. Now, wavelets are termed a brief oscillation. They're finite. Sinusoids extend to infinity but a wavelet exists for a finite duration. They have different shapes and sizes. Now, this is how a typical wavelet looks like. It starts at zero, ends at zero and, you know, oscillates in between. In order to perform a wavelet analysis, an appropriate mother wavelet is chosen. The mother wavelet is scaled and shifted through the time data to produce wavelets. So, the mother wavelet is like the main wavelet, which is then scaled and shifted to produce children wavelets. So, scaling is an operation in the frequency domain. Shifting is in the operation in the time domain. So, what is a mother wavelet? The correct selection of analyzing wavelet with different properties is very important for the wavelet analysis. And this analyzing wavelet is called the mother wavelet. The mother wavelet is transformed in time by the shifting variable, and it is also transformed in frequency by the scaling variable. And these time and frequency transformation results in wavelets or children wavelets. Now, examples of mother wavelet are Morlet wavelet, Mexican hat, Gaussian wavelet, etcetera. So, this is the wavelet equation, you know, C represents wavelet, A is the scaling variable, which is in the frequency domain, and B is the time shift variable in the time domain. So, what is scaling? Scaling means that the wavelet is scaled. That is, it is stretched or compressed in time. Now, a stretched wavelet is used to analyze low frequency content of a signal. Now, when you stretch a wavelet, it becomes it closely resembles a low frequency wave, which is which has a very, you know, large wavelength. And a compressed wavelet is used to analyze high frequency content of a signal. Again, a compressed wavelet is like, you know, it's compressed, so it resembles a high frequency signal with very short wavelength. So, this is an example of a stretched wavelet. So, you're stretching the wavelet so that it it's easier to capture the low frequency component of the signal. And this is a compressed wavelet. You're compressing it so it's useful to capture the high frequency content of a signal. Now, you know, this use of compressed and stretched wavelet would become very clear when we look at the wavelet wavelet analysis process. So, what is shifting? Shifting is in the time domain. So, shifting a wavelet simply means delaying or advancing the onset of a wavelet along the length of the signal. So, it's a process where each scaled wavelet is shifted in the time domain. So, for example, you know, you shift a wavelet, you by a time offset, and this is, you know, you're actually shifting the wavelet by the prescribed time. Now, let's understand the wavelet analysis process. So, first, let's say you have a signal you wish to analyze, for example, our door closed sound. A stretched or compressed wavelet is overlaid on top of this signal and shifted along the length of the signal. Now, when this wavelet is being shifted, at each time instant, the shape of the wavelet is compared with that shape of the signal. And mathematically, a wavelet correlates, matches with a signal if a portion of the signal is similar. And this correlation implies that that particular frequency is present and that signal at that particular time instant. That's really important, right? You need to know what frequency is present at what time so as to get good results, and that's where the wavelet analysis succeeds. So, same process is repeated for every wavelet. Now, we will look at this same thing in animation, so it becomes very clear. Now, let's say the background, you have a signal you wish to analyze, it's just a random signal, it's like our door closed sound. So, in the wavelet analysis, what you do is you take a wavelet and you slide it through the signal. So, when you're, you know, sliding it, at every instant, the wavelet is, you know, comparing itself with the signal and then telling, okay, at this frequency, at this particular time instance, this frequency was present if there is a match. If there is no match, then it was not present. Now, this we performed it with one wavelet. Now, the same thing we will perform with different wavelets. For example, let's say we use a a stretched wavelet so as to, you know, understand or analyze if there is any low frequency sound present. Now, the X-axis represents the time. So, when the wavelet is like sliding through the signal, so at every time instance, it's like comparing with the signal. Okay, if there is a good match, maybe that frequency is present at that particular time.

[13:19]So, you know, this is how it tells the result that at this particular time, this frequency is present. And again, you know, we repeat it with a compressed wavelet. So, this will help us in the high frequency components. So, we again, we slide it through this signal and then at every time instance, it's going to collect the information. If there is a match, it's going to tell that there is this particular frequency present. So, we repeat this process, I mean, it's repeated multiple times with multiple different wavelets. I just showed you three examples of a stretched and compressed, but every single wavelet is, you know, passed through this signal to understand what frequencies are present. And this is a technology that they use to, you know, give good results, to analyze impulsive sounds, to understand what how frequency changes with respect to time. So, this is a a typical wavelet analysis software used to do the same, exact same door close analysis, and you can see that how the picture is so crisp and clear compared to a traditional FFT. So, you get high frequency resolution and high time resolution at the same time. Now, I will overlay this with the window and you can actually see now and understand that what this high frequency and high time resolution means. So, you see here at as the frequency increases, it really doesn't matter if you have like good frequency resolution or not, because you're capturing all those. But at low frequencies, it really does matter to have high frequency resolution and it's okay to have poor time resolution. So, the most important thing was that this windowing actually correlates with our analysis. It does predict like, okay, at this particular time, um, you know, you have those frequencies present. So, it's pretty good. So, if you here's a comparison between FFT and wavelet. As you can see here, so it's pretty crisp and clear because it's a totally different technology. We're not using the traditional FFT approach, but we're using the wavelet approach to identify what frequencies are present at what time. So, as with everything else, even wavelet has a limitation. And due to custom multi resolution, wavelet analysis require long processing times compared to FFT. You know, compared to the FFT, the FFT stands for fast Forier transform. Yes, but the wavelet is not as fast as the Forier transform. But it does help in situation where FFT can't. The output files are pretty large in size, and it cannot be used for analyzing large time files, meaning like where FFT is already doing a great job, the wavelet is going to fail because it's not intended for that. So, to conclude, wavelet transform is a type of time frequency analysis. The wavelet transform overcomes the disadvantages of FFT by analyzing a signal with wavelets. And wavelet transform, a multi resolution windowing is used to capture signals with good time and good frequency resolution. And a wavelet is a wave-like oscillation with an amplitude that begins at zero, increase or decrease, and then returns to zero. All right. Thank you for watching this video. I hope you enjoyed it. Have a great day.

Need another transcript?

Paste any YouTube URL to get a clean transcript in seconds.

Get a Transcript