Fig5.10 <- function() { # postscript(file = "blockyplot.ps", height = 3.9, width = 6.5, horiz = F) par(mar = c(1.5, 1.5, 1.5, 0.5), mgp = c(5, 0.4, 0)) x <- (1:1024)/1024 blocky <- fblocks(x) plot(x, blocky, type = "l") # graphics.off() NULL } fblocks <- function(x) { n <- length(x) t <- c(0.1, 0.13, 0.15, 0.23, 0.25, 0.4, 0.44, 0.65, 0.76, 0.78, 0.81) h <- c(4, -5, 3, -4, 5, -4.2, 2.1, 4.3, -3.1, 2.1, -4.2) f <- rep(0, n) i <- 1 while(i <= 11) { ind <- ceiling(t[i] * n) f[ind:n] <- f[ind:n] + h[i] i <- i + 1 } f }