You could try something like this. Simulating with a large number of grid cells is however very RAM expensive.
library(MASS) library(spatial) x <- expand.grid(1:30, 1:30) distances <- as.matrix(dist(x, diag=T, upper=T)) Sigma <- expcov(r=distances, d=10, se=1) z <- mvrnorm(n = 1, mu=rep(0,900), Sigma) z <- matrix(z,nrow=30) image(z) ----- Original Message ----- From: "Brian Davenhall" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, June 03, 2004 10:46 PM Subject: [R] Simulating a landscape (matrix) in R > I'm trying to figure out how one might go about simulating a landscape > (matrix) in R. For example if one wanted to generate a simulated landscape > of precipitation values for some area (say a 100 X 100 matrix) they could > generate 10,000 numbers using a random normal distribution with a mean and > std. dev. and randomly allocate these generated numbers to the grid cells. > However, this is too simplistic and the resulting matrix will be very noisy > since one cell could have a very high value and an adjacent cell could have > a very low value. Is it possible to generate a simulated matrix that would > somehow incorporate a measure of spatial autocorrelation, so that grid cells > closer to each other are similar? > > > > Is this sort of thing possible in R to get a realistic surface or are other > software packages (e.g., surface visualizations/rendering) more appropriate > for this sort of thing? > > > [[alternative HTML version deleted]] > > ______________________________________________ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
