# Is this the correct way to perform filtering using Wavelet decomposition?

My math is a little bit rusty. I am learning a lot of stuff recently and some stuff is not clear yet. I ask anybody answering this, to not answer using complex mathematical notation because like I said, my math is rusty.

So, forgive me my ignorance.

I have this discrete time series signal and I want to filter it using Discrete Wavelet Decomposition. I am using Daubechies 4 type wavelets.

I have read in a lot of papers that to do that filtering I need to zero some coefficients in the way up, or in other words, in the inverse decomposition.

Let's represent the signal by S.

If I understood it correctly, this is what I have to do for a 4 level decomposition, filtering and reconstruction of the signal:

1. First I do a DWT on the signal and obtain the low and high frequency values:

(lowF1, highF1) = decompose(s)

2. Then I decompose lowF1 and obtain the second level low and high frequency values:

(lowF2, highF2) = decompose(lowF1)

3. I repeat the process and decompose lowF2 and obtain the third level low and high frequency values:

(lowF3, highF3) = decompose(lowF2)

4. I repeat the process and decompose lowF3 and obtain the fourth level low and high frequency values:

(lowF4, highF4) = decompose(lowF3)

Now it is time to filter and reconstruct the signal. I understand that I have to replace the high frequency part with an array of zeros, that will be what is called the threshold.

If that is true, to reconstruct the signal I do:

newSignalLevel3 = reconstruct(lowF3, zeroArray)
newSignalLevel2 = reconstruct(newSignalLevel3, zeroArray)
newSignalLevel1 = reconstruct(newSignalLevel2, zeroArray)
newSignal       = reconstruct(newSignalLevel1, zeroArray)


It it the way to do it?

Thresholding is to throw away only the coefficients which have lower absolute value than some value (the threshold). Depending on programming language this can be done in different ways.

In c or c++ you may want use for-loop:

for(int i=0; i<N_samples_highF1; i++)
if (absolute_value(highF1[i]) < thres)
highF1[i] = 0;


And then similarly for the other arrays.

Then you can use these highF1, highF2 et.c. in reconstruction instead of the all-zero arrays.

• Let's see if I got it. I have highF1, highF2, highF3 and highF4. Then I zero all values of these 4 arrays below a certain value. Then I use these new high frequencies arrays to reconstruct the signal, right? – SpaceDog Mar 19 at 19:08
• Yep it sounds right. – mathreadler Mar 19 at 19:28
• brilliant, thanks!!!!!!!!!!!!!!!! – SpaceDog Mar 19 at 19:40