Fig2.6 <- function() { # postscript(file = "Fig2.6.ps", horiz = F, height = 4.5, width = 3.5) par(mfrow = c(3, 1), mar = c(1.5, 1.5, 1.5, 0.5), mgp = c(5, 0.4, 0)) rs <- c(25, 61, 59, 54, 11, 1, 20, 35, 11, 15, 41, 3) .Random.seed <- rs n <- 32 x <- (1:n)/n y <- 1:(n/4) y <- (c(y, rev(y), rep(0, n/2)) * 9)/(n/4) xsca <- x * 2 * pi - pi ynoise <- y + rnorm(n) a0 <- (sum(ynoise) * 2)/n a1 <- (sum(ynoise * cos(x * 2 * pi - pi)) * 2)/n a2 <- (sum(ynoise * cos(2 * (x * 2 * pi - pi))) * 2)/n a3 <- (sum(ynoise * cos(3 * (x * 2 * pi - pi))) * 2)/n a4 <- (sum(ynoise * cos(4 * (x * 2 * pi - pi))) * 2)/n a5 <- (sum(ynoise * cos(5 * (x * 2 * pi - pi))) * 2)/n b1 <- (sum(ynoise * sin(x * 2 * pi - pi)) * 2)/n b2 <- (sum(ynoise * sin(2 * (x * 2 * pi - pi))) * 2)/n b3 <- (sum(ynoise * sin(3 * (x * 2 * pi - pi))) * 2)/n b4 <- (sum(ynoise * sin(4 * (x * 2 * pi - pi))) * 2)/n b5 <- (sum(ynoise * sin(5 * (x * 2 * pi - pi))) * 2)/n npoints <- 150 u <- (0:(npoints - 1))/(npoints - 1) usca <- u * 2 * pi - pi plot(xsca, ynoise, ylim = c(min(ynoise), max(ynoise))) lines(usca, a0/2 + a1 * cos(usca) + b1 * sin(usca)) mtext("J=1", side = 3, line = 0.1) plot(xsca, ynoise, ylim = c(min(ynoise), max(ynoise))) lines(usca, a0/2 + a1 * cos(usca) + b1 * sin(usca) + a2 * cos(2 * usca) + b2 * sin(2 * usca) + a3 * cos(3 * usca) + b3 * sin(3 * usca)) mtext("J=3", side = 3, line = 0.1) plot(xsca, ynoise, ylim = c(min(ynoise), max(ynoise))) lines(usca, a0/2 + a1 * cos(usca) + b1 * sin(usca) + a2 * cos(2 * usca) + b2 * sin(2 * usca) + a3 * cos(3 * usca) + b3 * sin(3 * usca) + a4 * cos(4 * usca) + b4 * sin(4 * usca) + a5 * cos(5 * usca) + b5 * sin(5 * usca)) mtext("J=5", side = 3, line = 0.1) # graphics.off() NULL }