Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. library(mgcv)
  2.  
  3.  
  4. x<- rnorm(200)
  5. y<- rnorm(200)
  6. z<-rnorm(200)
  7.  
  8. tab<-data.frame(x,y,z)
  9. tab
  10.  
  11. #surface wireframe:
  12.  
  13. mod <- gam(z ~ te(x, y), data = tab)
  14.  
  15. wyk <- matrix(fitted(mod), ncol = 20) #8 i 10 też ok
  16.  
  17. wireframe(wyk, drape=TRUE, colorkey=TRUE)
  18.  
  19. #surface persp3d
  20.  
  21.  
  22. library(rgl)
  23. library(akima)
  24.  
  25.  
  26. z_interpolation <- 200
  27.  
  28. tabint <- interp(x, y, z)
  29.  
  30. x.si <- tabint$x
  31. y.si <- tabint$y
  32. z.si <- tabint$z
  33. jet.colors <- colorRampPalette( c("lightpink", "slateblue4") )
  34. nbcol <- 200
  35. vertcol <- cut(t, nbcol)
  36. color = rev(rainbow(nbcol, start = 0/6, end = 4/6))
  37. persp3d(x.si, y.si, z.si, col = color[vertcol], smooth=T)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement