Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(mgcv)
- x<- rnorm(200)
- y<- rnorm(200)
- z<-rnorm(200)
- tab<-data.frame(x,y,z)
- tab
- #surface wireframe:
- mod <- gam(z ~ te(x, y), data = tab)
- wyk <- matrix(fitted(mod), ncol = 20) #8 i 10 też ok
- wireframe(wyk, drape=TRUE, colorkey=TRUE)
- #surface persp3d
- library(rgl)
- library(akima)
- z_interpolation <- 200
- tabint <- interp(x, y, z)
- x.si <- tabint$x
- y.si <- tabint$y
- z.si <- tabint$z
- jet.colors <- colorRampPalette( c("lightpink", "slateblue4") )
- nbcol <- 200
- vertcol <- cut(t, nbcol)
- color = rev(rainbow(nbcol, start = 0/6, end = 4/6))
- persp3d(x.si, y.si, z.si, col = color[vertcol], smooth=T)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement