draw.default {wavethresh} | R Documentation |
Draws pictures of basic (Daubechies') wavelets in the wavethresh package.
## Default S3 method: draw(x = filter.number, filter.number = 2, family = c("DaubExPhase", "DaubLeAsymm"), resolution = 1024, verbose = FALSE, plot = TRUE, main = paste("Wavelet Picture", if(enhance) " (Enhanced)", sep=""), sub = zwd$filter$name, xlab = "x", ylab = expression(psi(x)), dimension = 1, twodplot = persp, enhance = TRUE, efactor = 0.05, ...)
x, filter.number |
integer; number of the filter in the wavelet family specified. The range of possible numbers depends on the family. |
family |
character, the family of wavelets to use, defaults to the first of the list shown above. |
resolution |
integer specifying the resolution to use in drawing pictures. A higher resolution gives a better quality picture but will take longer to draw (especially in two dimensions). |
verbose |
logical, if TRUE , report the progress of drawing. |
plot |
logical, if true then plot the appropriate wavelet on the current active graphics device, otherwise the information about the wavelet is returned. |
main, sub |
main and sub-title for the plot, see title . |
xlab, ylab |
labels for the x and y axis. |
dimension |
If this is 1, then a one-dimensional version of the wavelet is drawn,
if this is 2, then a two-d picture is drawn with the twodplot function.
|
twodplot |
function such as persp that can do
something interesting with a matrix. |
enhance |
logical; with Daubechies' wavelets their effective
support is much less than their actual support.
If enhance is true, the function tries to draw
the wavelet on its effective support. |
efactor |
numeric, defining the effective support. Define z0 to be efactor times the maximum absolute value of the wavelet w(x). Define the set A = { x: |w(x)| > z0 }, and the effective support is the smallest interval (in 1D, square in 2D) containing A. |
... |
further arguments to plot or twodplot . |
For Daubechies' compactly supported wavelets there is no known closed form expression. However, it is possible to make use of the inverse wavelet transform to draw pictures of the wavelets. The idea is to set all but one wavelet coefficient equal to zero and that one coefficient equal to one in a wavelet expansion. Then the inverse transform (reconstruction) is applied to the expansion and a picture of one wavelet is produced.
A method similar to the one we present here is presented in Daubechies (1992) in Section~6.5 on the cascade algorithm.
The principle is simple, but the implementation to get good pictures is surprisingly tricky. Ideally you want to put in the non-zero coefficient at the lowest resolution level as possible, this will give you as much detail as possible. However, the support of some of the large-scale wavelets is greater than the union of the supports of all the high-resolution small-scale wavelets and so it may not be possible to draw a complete wavelet.
This function analyses the supports of the wavelets at different levels and finds a coefficient to set to one by choosing the wavelet at the lowest possible resolution and whose support is within the union of supports of the highest resolution wavelets. If there is a choice of such wavelets, then the middle-most one is selected.
If plot
is false then no actual drawing is done, however, a list is
returned with dimension + 1
components:
If dimension
is one, the list has components x and y, representing the
domain of definition (or effective support) of the wavelet and the
value of the wavelet at x.
If dimension == 2
, the list has three components x,y and z.
a picture of a wavelet is drawn on the currently active graphics device if plot=TRUE.
Release 2.2 Copyright Guy Nason 1993
op <- par(mfrow=c(5,2), oma = c(0,0, 4, 0), mgp = c(1.2, .8, 0), mar = .1 + c(4,4, .5,1)) for(fn in 1:10) { draw.default(filter.number= fn, col = "blue", main = NULL, xlab= "") abline(h=0,v=0, lty=3, lwd=.5, col = "gray") } mtext(paste("draw.default(*, family = '",formals(draw.default)$family[[2]],"')"), side = 3, line = 1, outer = TRUE, cex = par("cex.main"), font = par("font.main")) par(op) # Draw a 2-dimensional Daubechies least asymmetric wavelet draw.default(filter.number=6, family="DaubLeAsymm", dim=2, resolution=128)