diff --git a/ch08.r b/ch08.r index b308eee..c966b9f 100644 --- a/ch08.r +++ b/ch08.r @@ -15,6 +15,16 @@ S_grid = mesh$X theta_grid = mesh$Y L = S_grid * log(theta_grid) + (N-S_grid) * log(1-theta_grid) L = t(L) -persp3D(S, theta, L, theta=65, phi=15) +persp3D(S, theta, L, theta=65, phi=15, border="black", lwd=0.3, bty="b2", xlab="S", ylab="θ", zlab="", ticktype="detailed") + +N = 50 +S = seq(from=1, to=N, by=0.1) +theta = seq(0.1, 0.9, (0.1+0.9)/1000) +mesh = meshgrid(S, theta) +S_grid = mesh$X +theta_grid = mesh$Y +L = S_grid * log(theta_grid) + (N-S_grid) * log(1-theta_grid) +L = t(L) +image(S, theta, L, col=rainbow(256), ylim=c(0.9, 0.1)) #############