|
Essential Wavelets for Statistical Applications and Data Analysis R.T. Ogden, University of South Carolina 0-8176-3864-4 * 1996 * $40.00 * Hardcover * 285 pages * 40 Illustrations |
Fig1.2 <- function()
{
# postscript(file = "Fig1.2.ps", height = 6.5, width = 6.5, horiz = F)
par(mfrow = c(2, 2), mar = c(1.5, 1.5, 1.5, 0.5), mgp = c(5, 0.4, 0))
x <- seq( - pi, pi, by = 0.01)
# Create example function on grid
ex <- sapply(x, examplef)
# Compute basis functions (also on
# grid)
c1 <- cos(x)
c2 <- cos(2 * x)
c3 <- cos(3 * x)
# Compute coefficients numerically
a0 <- (sum(ex) * 0.01)/pi
a1 <- (sum(ex * c1) * 0.01)/pi
a2 <- (sum(ex * c2) * 0.01)/pi
a3 <- (sum(ex * c3) * 0.01)/pi
# Plotting of various reconstructions
plot(x, ex, type = "l", ylim = c(0, 1.8))
mtext("Example function", side = 3, line = 0.1)
plot(x, a0/2 + a1 * c1, type = "l", ylim = c(0, 1.8))
mtext("Reconstruction with J=1", side = 3, line = 0.1)
plot(x, a0/2 + a1 * c1 + a2 * c2, type = "l", ylim = c(0, 1.8))
mtext("Reconstruction with J=2", side = 3, line = 0.1)
plot(x, a0/2 + a1 * c1 + a2 * c2 + a3 * c3, type = "l", ylim = c(0, 1.8))
mtext("Reconstruction with J=3", side = 3, line = 0.1)
# graphics.off()
NULL
}
examplef <- function(x)
{
if(x <= - pi/2 && x >= -pi)
return(x + pi)
else if(x > pi/2 && x<= pi)
return(pi - x)
else if(x < -pi || x >pi)
return(0)
else
return(pi/2)
}