Location: Interpolation field over mesh with uncertain nodal values @ 2c071a035c01 / genmodel.R

Author:
Andrew Miller <ak.miller@auckland.ac.nz>
Date:
2012-02-27 12:26:16+13:00
Desc:
Add drawing showing mesh structure, rendered images, and R script used to generate realisations shown
Permanent Source URI:
https://models.cellml.org/w/miller/uncertaingrid/rawfile/2c071a035c01e1601439467c2c85a5a25834fd15/genmodel.R

xcoords <- c()
ycoords <- c()
xValues <- 1:5
yValues <- 1:5
for (x in xValues)
{
  for (y in yValues)
    {
      xcoords <- c(xcoords, x);
      ycoords <- c(ycoords, y);
    }
}

dataValue <- c()
for (realisation in 1:1000)
{
  baseValue <- rnorm(1, 10, 1)
  pointSigma <- rexp(1, 1)
  coeffX <- rnorm(1, 1, 0.1)
  coeffY <- rnorm(1, 0, 0.2)
  for (x in xValues)
    {
      for (y in yValues)
        {
          value <- baseValue + x * coeffX + y * coeffY + rnorm(1, 0, pointSigma)
          dataValue <- c(dataValue, value)
          cat(value, ' ')
        }
      cat("\n")
    }
}