hide long namesshow long names
hide short namesshow short names
Integer type:  int32  int64  nag_int  show int32  show int32  show int64  show int64  show nag_int  show nag_int

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

NAG Toolbox: nag_wav_1d_mxolap_inv (c09db)

 Contents

    1  Purpose
    2  Syntax
    7  Accuracy
    9  Example

Purpose

nag_wav_1d_mxolap_inv (c09db) computes the inverse one-dimensional maximal overlap discrete wavelet transform (MODWT) at a single level. The initialization function nag_wav_1d_init (c09aa) must be called first to set up the MODWT options.

Syntax

[y, ifail] = c09db(ca, cd, n, icomm, 'lenc', lenc)
[y, ifail] = nag_wav_1d_mxolap_inv(ca, cd, n, icomm, 'lenc', lenc)

Description

nag_wav_1d_mxolap_inv (c09db) performs the inverse operation of nag_wav_1d_mxolap_fwd (c09da). That is, given sets of nc approximation coefficients and detail coefficients, computed by nag_wav_1d_mxolap_fwd (c09da) using a MODWT as set up by the initialization function nag_wav_1d_init (c09aa), on a real data array of length n, nag_wav_1d_mxolap_inv (c09db) will reconstruct the data array yi, for i=1,2,,n, from which the coefficients were derived.

References

Percival D B and Walden A T (2000) Wavelet Methods for Time Series Analysis Cambridge University Press

Parameters

Compulsory Input Parameters

1:     calenc – double array
The nc approximation coefficients, Ca. These will normally be the result of some transformation on the coefficients computed by nag_wav_1d_mxolap_fwd (c09da).
2:     cdlenc – double array
The nc detail coefficients, Cd. These will normally be the result of some transformation on the coefficients computed by nag_wav_1d_mxolap_fwd (c09da).
3:     n int64int32nag_int scalar
n, the length of the original data array from which the wavelet coefficients were computed by nag_wav_1d_mxolap_fwd (c09da) and the length of the data array y that is to be reconstructed by this function.
Constraint: This must be the same as the value n passed to the initialization function nag_wav_1d_init (c09aa).
4:     icomm100 int64int32nag_int array
Contains details of the discrete wavelet transform and the problem dimension and, possibly, additional information on the previously computed forward transform.

Optional Input Parameters

1:     lenc int64int32nag_int scalar
Default: the dimension of the arrays ca, cd. (An error is raised if these dimensions are not equal.)
The dimension of the arrays ca and cd.
Constraint: lencnc, where nc is the value returned in nwc by the call to the initialization function nag_wav_1d_init (c09aa).

Output Parameters

1:     yn – double array
The reconstructed data based on approximation and detail coefficients Ca and Cd and the transform options supplied to the initialization function nag_wav_1d_init (c09aa).
2:     ifail int64int32nag_int scalar
ifail=0 unless the function detects an error (see Error Indicators and Warnings).

Error Indicators and Warnings

Errors or warnings detected by the function:
   ifail=1
On entry, array dimension lenc not large enough.
   ifail=4
On entry, n is inconsistent with the value passed to the initialization function.
   ifail=6
On entry, the initialization function nag_wav_1d_init (c09aa) has not been called first or it has not been called with wtrans='T', or the communication array icomm has become corrupted.
   ifail=-99
An unexpected error has been triggered by this routine. Please contact NAG.
   ifail=-399
Your licence key may have expired or may not have been installed correctly.
   ifail=-999
Dynamic memory allocation failed.

Accuracy

The accuracy of the wavelet transform depends only on the floating-point operations used in the convolution and downsampling and should thus be close to machine precision.

Further Comments

None.

Example

See Example in nag_wav_1d_mxolap_fwd (c09da).
function c09db_example


fprintf('c09db example results\n\n');

% 1d maximal overlap discrete wavelet decomposition using a Daubechies wavelet

n      = int64(8);
x      = [1 3 5 7 6 4 5 2];

wavnam = 'DB4';
mode   = 'Periodic';
wtrans = 'Time invariant';

% Setup for wavelet
[nwlmax, nf, nwc, icomm, ifail] = c09aa(wavnam, wtrans, mode, n);

% Compute decomposition
[ca, cd, icomm, ifail] = c09da(x, nwc, icomm);

disp('Approximation coefficients:')
fprintf('%8.4f',ca);
fprintf('\n');
disp('Detail coefficients:')
fprintf('%8.4f',cd);
fprintf('\n');

% Reconstruct
[y, ifail] = c09db(ca, cd, n, icomm);
disp('Reconstruction:')
fprintf('%8.4f',y);
fprintf('\n');


c09db example results

Approximation coefficients:
  2.7781  1.5146  2.2505  4.8788  6.6845  6.3423  4.7869  3.7644
Detail coefficients:
 -0.6187  0.6272  0.1883 -1.1966  1.2618  0.3354 -0.3314 -0.2660
Reconstruction:
  1.0000  3.0000  5.0000  7.0000  6.0000  4.0000  5.0000  2.0000

PDF version (NAG web site, 64-bit version, 64-bit version)
Chapter Contents
Chapter Introduction
NAG Toolbox

© The Numerical Algorithms Group Ltd, Oxford, UK. 2009–2015