How to draw a haar wavelet plot using pywt?

1.9k Views Asked by At

I'm only in the beginning of learning wavelet transformation, so I have such naive question.

I have quite simple scaling function with only two non-zero coefficients:

enter image description here

h(0) = h(1) = 1/ sqrt(2)

I have calculated the average and difference part on my own, and now I want to draw a plot to describe my DWT.

How to show this plot using pywt library on interval [0,1]

My vector is a = [8,2,1,6,3,−9,7,4]

My graph, should look like something similar to this one: https://yadi.sk/i/3MIfn3tF3NRFsB

1

There are 1 best solutions below

0
On

It is to really clear what you are doing, but to get something that look like the image you gave the link, you can do :

>>> import matplotlib.pyplot as plt
>>> a = [8,2,1,6,3,-9,7,4]
>>> x = [float(i)/len(a) for i in range(len(a))]
>>> plt.step(x,a)
[<matplotlib.lines.Line2D object at 0x7f49fa6868d0>]
>>> plt.show()

to obtain : enter image description here