diff --git a/ch10.r b/ch10.r new file mode 100644 index 0000000..bbdec77 --- /dev/null +++ b/ch10.r @@ -0,0 +1,17 @@ +############# +# Chapter 10.2 Mean and correlation functions + +## Example 10.5 + +# R code for Example 10.5 +x = matrix(0, 1000, 20) +t = seq(-2, 2, (2+2)/999) + +for (i in 1:20) { + x[,i] = runif(1) * cos(2 * pi * t) +} + +matplot(t, x, lwd=2, col="gray") +lines(t, 0.5*cos(2*pi*t), lwd=4, col="darkred") +grid() +