Below are the solutions to these exercises on 3D plots.

############### # # # Exercise 1 # # # ############### m <- matrix(runif(100),10,10) image(m)

############### # # # Exercise 2 # # # ############### m <- matrix(runif(100),10,10) image(m, axes = FALSE, col = grey(seq(0, 1, length = 256)),oldstyle=T)

############### # # # Exercise 3 # # # ############### n <- matrix(runif(50),5,5)contour(n)############### # # # Exercise 4 # # # ############### fun <- function(x, y){ (x+y)/2 } x <- y <- seq(1, 3, length= 20) z <- outer(x,y,fun) persp(x, y, z)# #

# Exercise 5 #

# #

###############x <- seq(0, 20, length= 30)

y <- x

fun <- function(x, y) { (x+y)/2 }

z <- outer(x, y, fun)

persp(x, y, z, theta = 30, phi = 60, expand = 0.5, col = "blue")

############### # # # Exercise 6 # # # ############### x <- seq(-10, 10, length= 30) y <- x persp(x, y, z, theta = 30, phi = 60, expand = 0.5, col = "green", ltheta = 120, shade = 0.75, ticktype = "detailed", xlab = "X", ylab = "Y", zlab = " r " )

############################## # # # Exercise 7 # # # ############### y <- x <- seq(3,6,length=30) fun <- function(x,y) { return(dnorm(x)/dnorm(y)) } z <- outer(x,y,fun) persp(x,y,z)

## Leave a Reply