# Discrete wavelet transform; how to interpret approximation and detail coefficients?

I am trying to understand Wavelet transform. So far I have understood the basic theory of it. But I am not able to get my head around how to interpret both coefficients.

I am using PyWavelets package of python, I have a time-series data for 1 year equally divided into 15-min time interval. I am trying to get high-frequency components for each day. Fourier transform gives the information about high-frequency. But I would like to get time-information also i.e. at what part during the day there occurs a spike(high-frequency). If someone could please help me figure out this and how to plot time-frequency. I have searched a lot but couldn't find a perfect answer. I am not looking for a free solution without trying; Here is everything I have tried

tdayde=d2012_2['Date'].iloc[0]
endde=d2012_2['Date'].iloc[-1]
skiphr=datetime.timedelta(hours=24)
blockde=tdayde+skiphr


I have timestamps attached to data, so to plot for each day I am using

healtharrayde=d2012_2
healtharrayde=healtharrayde[(healtharrayde['Date'] >= tdayde) & (healtharrayde['Date'] < blockde)]
sig=list(healtharrayde['MCP'])
cA, cD = pywt.dwt(sig, 'db2')
plt.plot(cD)
plt.plot(cA)


So if there are 96 values in array, both cD and cA are 48 values each. I would like to understand and plot cD(detail components) with respect to time, So how should I do? because there are 96 timestamps(MCP is column name for values)

Sorry if it's a silly question but I really need help. Thank you

Wavelet transforms can be more difficult to interpret than FFT at face value due to the various representations, nomenclature and output formats. I had to study more than 15 resources to get a good sense of the variety and which one is used by Pywavelets (which does not provide much theory or explanation in its documentation).

In order to grasp the meaning of cD and cA coefficients, it is helpful to run through a basic example wavelet transform calculation. Here's a simple step-by-step calculation of what happens in a multi-level DWT (your example is basically the first level). In this representation, they concatenate cA and cD coefficients side by side.

When running DWT using a specific basis function, the signal is fed through (inner product with) a high pass filter (difference filter) and a low pass filter (smoothing / averaging filter), each of which is unique to the wavelet basis function.

For 'db2', the high/ low pass filtering each has two terms, and occurs with a step size (stride) of 2, therefore, after the filtering is completed, you also get a downsampling by 2 of the original signal. Actual length will depend on the filter length and the signal extension mode. The high pass filtered result gives you the cD coefficients. The low pass filtered result gives you the cA coefficients.

In your example, each of the 48 cD and 48 cA coefficients corresponds to 2 of the original 96 data points. Therefore, to plot the cA and cD coefficients in time, just reduce time resolution by 2.

• This has some simple equations and intuitive comparisons to FFT

• This has some nice graphical representations and color coding to explain multi-level DWT

• Another guide with detailed explanation and illustrations

• The simple step-by-step calculation is really good, but the PDF at the link was just static, not an animation (as the authors originally wrote it). Does anyone know where an animated version might be found> Commented Apr 25, 2018 at 1:12
• Is a better way to think about wavelets as a sum of some function (lets say we wanted to model something using Triangle Waves...so we could use a Tringle Wave Transform, i.e., Wavelet) whereas FT is just a specific case of wavelets just using it as a sum of sin/cos waves? Commented Aug 22, 2018 at 20:55

The simplest interpretation of cA (approximate coefficients) and cD (detail coefficients):

cA: low-frequency component of the signal

cD: high-frequency component of the signal