[a,d] =
haart(x) returns the approximation
coefficients, a, and detail coefficients, d,
of a 1-D Haar discrete wavelet transform. The input x can
be univariate or multivariate data. The default level depends
on the length of x.

Obtain the Haar transform of a multivariate time series dataset of electricity consumption data down to level 4. The signals data is transposed so that each time series is in a column, rather than a row.

Obtain the Haar transform. Then, obtain the inverse Haar transform approximated at level 5. The scale for this level is 512 seconds, which is $${2}^{5}$$ times the sampling interval (16 seconds).

x — Input signal vector of real values | matrix of real values

Input signal, specified as vector or matrix of real values.
If x is a vector, it must be even length. If x is
a matrix, each column must be even length, and haart operates
on each column of x.

Data Types: double

level — Maximum level positive integer

Maximum level to which to perform the Haar transform, specified
as a positive integer. The default value depends on the length of
the input signal, x.

If the length of x is a power
of two, the Haar transform is obtained down to level log2(length(x)).

If the length of x is even, but
not a power of two, the Haar transform is obtained down to level floor(log2(length(x)/2)).

If level is 1, the detail coefficients, d,
are returned as a vector or matrix, depending on whether the input
is a vector or matrix, respectively.

integerflag — Integer-valued data handling 'noninteger' (default) | 'integer'

Integer-valued data handling, specified as either 'noninteger' or
'integer'.
'noninteger' does not preserve
integer-valued data in the Haar transform, and
'integer' preserves it. The
'integer' option applies only
if all elements of the input,
x, are integers. For
integer-valued input, haart
returns integer-valued wavelet coefficients. For
both 'noninteger' and
'integer', however, the Haar
transform algorithm uses floating-point
arithmetic. The data type of outputs
a and d,
is always double.

a — Approximation coefficients scalar | vector | matrix

Approximation coefficients, returned as a scalar, vector, or
matrix of coefficients, depending on the level to which the transform
is calculated. 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.

Detail coefficients, returned as a scalar, vector, matrix, or cell array. Detail coefficients are generally referred to as wavelet coefficients. The number of detail coefficients depends on the selected level and the length of the input. If d is a cell array, the elements of d are ordered from finest to coarsest resolution.

Note: Generated C and C++ code always returns the wavelet coefficients d in a cell array.

Data Types: double

Extended Capabilities

C/C++ Code Generation Generate C and C++ code using MATLAB® Coder™.

You can also select a web site from the following list:

How to Get Best Site Performance

Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.