Signal Decomposition

DESCRIPTION:

Decomposes a signal or an image into components determined by the given basis or molecules.

This function is an S Version 3 generic (see Methods); method functions can be written to handle specific S Version 3 classes of data. Classes which already have methods for this function include:
cpt, cp.molecule, dwt, nd.dwt, rob.dwt, rob.dwt.list, wpt, wp.molecule .

USAGE:

decompose(x, top=NULL, data=NULL, order.crystal="energy") 

REQUIRED ARGUMENTS:

x
an object of cpt, cp.molecule, dwt, nd.dwt, rob.dwt,rob.dwt.list, wpt, wp.molecule.

OPTIONAL ARGUMENTS:

top
number of coefficients (atoms) in x used in the decomposition, in effect only if x is an object of class "molecule". By default, use all the coefficients in x. See details below.
data
if provided, residual term will be computed and attached at the end of the decomposition. This argument used only if x is an object of class "molecule". See details below.
order.crystal
a character string: "dwt" (for the DWT decomposition only), "energy" (the decomposition components will be ordered by energy), and "frequency" (in depth.first order).

VALUE:

an object of class decompose. See decompose.object for details.

DETAILS:

The function decompose produces a decomposition which is a sum of components where each k-th component represents the contribution of the k-th crystal (when x is of class cpt or wpt) or the atom associated with the k-th largest coefficient (when x is of class cp.molecule or wp.molecule to the signal.

When x is of class "cpt" or "wpt", all atoms with non-zero coefficients are included in the decomposition, the sum of the components yields the original series.

When x is of class "cp.molecule" or "wp.molecule", if data is provided, the sum of the components yields an approximation of the data with a (non-trivial) residual term attached at the end of the outcome matrix. The bigger the top, the closer the approximation to the original signal; if data is missing, the sum of the components only yields an approximation to the original signal.

SEE ALSO:

, , , , , , , .

EXAMPLES:

xx <- make.signal("ramp", 1024) 
par(mfrow=c(2,2)) 
plot(xx, type="l", xlab="") 
xx.dwt <- dwt(xx, wavelet="s8", n.levels=4) 
plot(xx.dwt) 
xx.dec <- decompose(xx.dwt) 
plot(xx.dec) 
xx.top <- top.atoms(xx.dwt, n.atoms=10) 
xx.dec1 <- decompose(xx.top, data=xx)    # decompose signal on the top 10 atoms 
plot(xx.dec1)