How to decompose a signal using wavelet

 Wavelet transform is a great tool for signal feature extraction. It is generally used in scientific research. There are two types of the wavelet transform. One is the continuous and the other is the discrete wavelet transform. Depending on the application, the type of wavelet transform is selected.

Wavelet Decomposition in Matlab


DWT is normally used in signal decomposition. It filters the signal using a high pass and a low pass filter where the coefficients achieved from the low pass filter are called the approximations and the coefficients from the high pass filter are called the detail components. It can also be used to denoise a signal. The same process used in the code can be utilized to filter out noises from a signal.

The choice of wavelet type and level of decomposition is strictly subjective and kinda trial based procedure. You need to find out what works better for your case.

I've taken a sample signal for demonstration. You can basically take any signal and then add gaussian noise to it then try this procedure if you're learning. If you already have a noisy signal we're good to go.

Signal Decomposition using Wavelet in MATLAB

There are two ways available in MATLAB to do this. The first one is the simplest way. You can just use the built-in MATLAB app Wavelet Analyzer to perform all kind of wavelet operations on the signal. You just need to type in "waveletAnalyzer" in the command window to open the app. You can find both methods in the video attached below. However, in this post I'm going to talk about doing it manually using codes.

clc;
clear all;

load sumsin;  % loading a sample signal from matlab

[c, l] = wavedec(sumsin, 3, 'db2');  
approximation = appcoef(c, l, 'db2');  % extracting the approximation co-efficients 
[d1, d2, d3] = detcoef(c, l, [1 2 3]);  % extracting the level 3 detail coefficients 

subplot(4, 1, 1)
plot(approximation);
title('Approximation at Level 3')
subplot(4, 1, 2)
plot(d3)
title('Detail Coefficients at Level 3');
subplot(4, 1, 3)
plot(d2)
title('Detail Coefficients at Level 2');
subplot(4, 1, 4)
plot(d1)
title('Detail Coefficients at Level 1');


Download the code for wavelet decomposition from the link below.

Watch the Full video on wavelet decomposition


কোন মন্তব্য নেই

Blogger দ্বারা পরিচালিত.