diff --git a/ch10.r b/ch10.r index bbdec77..365ffea 100644 --- a/ch10.r +++ b/ch10.r @@ -12,6 +12,19 @@ for (i in 1:20) { } matplot(t, x, lwd=2, col="gray") -lines(t, 0.5*cos(2*pi*t), lwd=4, col="darkred") grid() +lines(t, 0.5*cos(2*pi*t), lwd=4, col="darkred") + +## Example 10.6 + +# R code for Example 10.6 +x = matrix(0, 1000, 20) +t = seq(-2, 2, (2+2)/999) +for (i in 1:20) { + x[,i] = cos(2*pi*t+2*pi*runif(1)) +} + +matplot(t, x, lwd=2, col="gray") +grid() +lines(t, 0*cos(2*pi*t), lwd=4, col="darkred")