Discrete Wavelet Transform Calculator

JJ Ben-Joseph headshot JJ Ben-Joseph

Haar Discrete Wavelet Transform overview

This calculator computes a one-level Haar discrete wavelet transform (DWT) for a real-valued sequence whose length is a power of two (2, 4, 8, 16, …). It returns two sequences:

The Haar wavelet is the simplest wavelet basis. It uses piecewise-constant functions to summarize each pair of samples with their average and their difference.

Formulas for the one-level Haar DWT

Suppose you have an input sequence x0,x1,,xN1 with N even. For a one-level Haar transform we group samples in pairs:

(x0,x1),(x2,x3),,(xN2,xN1).

For each pair we compute an approximation coefficient ak and a detail coefficient dk:

ak = x2k + x2k+1 2 ,   dk = x2k - x2k+1 2

Here k=0,1,,(N2)1. The calculator uses this averages and differences form, which is easy to interpret numerically.

Reconstruction (inverse transform)

From the approximation and detail coefficients, you can recover the original samples pairwise as

x2k=ak+dk and x2k+1=ak-dk.

In terms of explicit formulas:

x2k = ak + dk ,   x2k+1 = ak - dk

This shows that no information is lost at this level: the transform is invertible as long as all ak and dk are kept.

Worked example

Consider the simple sequence of length 4:

x=24610.

  1. Pair (2, 4)
    aa0=(2+4)/2=3
    dd0=(24)/2=1
  2. Pair (6, 10)
    aa1=6+102=8
    dd1=(610)/2=2

The calculator would report:

You can check reconstruction:

How to interpret the results

For signal denoising or compression, it is common to keep the approximation coefficients and selectively shrink or discard small detail coefficients.

Comparison: Haar DWT vs. direct samples vs. Fourier

Representation What it emphasizes Localization in time Typical use
Raw samples xn Exact values at each index Perfect in time, no frequency separation Storage, direct plotting, simple statistics
Haar DWT coefficients ak,dk Local averages and differences Good time localization, coarse frequency separation Edge detection, compression, denoising, multiresolution analysis
Fourier coefficients Global sinusoidal components Poor time localization, fine frequency resolution Spectral analysis, filtering of stationary signals

Limitations and assumptions of this calculator

Within these limits, the calculator is well suited for learning how the Haar DWT works, checking hand calculations, and exploring basic signal features.

Enter a sequence.

Embed this calculator

Copy and paste the HTML below to add the Discrete Wavelet Transform Calculator – One-Level Haar DWT to your website.