Inverse 1-D Haar wavelet transform
xrec = ihaart(a,d)
xrec = ihaart(a,d,level)
xrec = ihaart(___,integerflag)
Obtain the Haar and inverse Haar transforms of noisy data.
Load the noisy data signal
Obtain the Haar transform of the noisy signal.
[a,d] = haart(noisdopp);
Reconstruct the data by inverting the Haar transform.
xrec = ihaart(a,d);
Compare the original and reconstructed data by determining the maximum difference between them. The difference is essentially zero, which indicates a near-perfect reconstruction.
ans = 4.4409e-15
Obtain the Haar transform and inverse Haar transform of ECG heart rate data.
Load and plot the ECG data.
load BabyECGData; plot(times,HR) xlabel('Hours') ylabel('Heart Rate') title('ECG Data')
Obtain the Haar transform and inverse Haar transform. Compare the reconstructed data at level 4 to the original data.
[a,d] = haart(HR); HaarHR = ihaart(a,d,4); figure plot(times,HaarHR) xlabel('Hours') ylabel('Heart Rate') title('Haar Approximation of Heart Rate')
Obtain the Haar and inverse Haar transforms for a series of random integers.
Create the series.
x = randi(10,100,1);
Obtain the Haar and inverse Haar transforms.
[a,d] = haart(x,'integer'); xrec = ihaart(a,d,'integer');
Plot and compare the original and reconstructed data.
subplot(2,1,1) stem(x); title('Original Data') subplot(2,1,2) stem(xrec) title('Reconstructed Integer-to-Integer Data')
Determine the maximum difference between the original data values and the reconstructed values. The difference is zero, which indicates perfect reconstruction.
ans = 0
a— Approximation coefficients
Approximation coefficients, specified as a scalar, vector, or
matrix of coefficients, depending on the level to which the Haar transform
a is an output from the
Approximation, or scaling, coefficients are a lowpass representation of the input. At each level the approximation coefficients are divided into coarser approximation and detail coefficients.
d— Detail coefficients
Detail coefficients, specified as a scalar, vector, matrix,
or cell array of wavelet coefficients, which are a highpass representation
of the input.
d is an output from the
haart function. The number of detail
coefficients depends on the selected level and the length of the input.
The order of the elements of
d is from fine to
coarse resolution levels.
d is a cell array, it can contain scalars,
vectors, or matrices. The level of the Haar transform equals the number
of elements in
d. The coarsest resolution level
element of the
d cell array is a scalar value.
d is a vector or matrix, the Haar transform
was computed only down to one level coarser in resolution. If you
specify only two levels, the detail coefficient is a scalar.
a and the elements of
xrec is a vector. If
the elements of
d are matrices,
a matrix, where each column is the inverse Haar transform of the corresponding
level— Maximum level
0(default) | nonnegative integer
integerflag— Integer-valued data handling
Integer-valued data handling, specified as a character vector.
not preserve integer-valued data, and
'integer' option applies only if all elements
d are integer-valued.
You must have used
The inverse 1-D Haar transform algorithm, however, uses floating-point
xrec— Inverse 1-D Haar wavelet transform