From 0b9a7c7b6c3bc7aebc62101fe2e435f265736d50 Mon Sep 17 00:00:00 2001 From: aaaakshat <33050725+aaaakshat@users.noreply.github.com> Date: Wed, 3 Nov 2021 16:12:24 -0400 Subject: [PATCH] Add example 10.5 --- ch10.r | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 ch10.r 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() +