voss2g | R Documentation |
Fractal Brownian function on 2D grid with a generic Voss algorithm
Description
voss2g()
function generates realizations of a fractal Brownian function on uniform 2D grid (FBF(x,y)) with a generic version of the Voss algorithm (random sequential additions).
Usage
voss2g(p=cbind(n=0.5^-seq(0,7)+1, s=dchisq(seq(0,7), df=2)), center=TRUE)
Arguments
p |
a matrix of parameters:nrow(p) a number of iterations;p[,"n"] a number of partition points in the iteration process;p[,"s"] a standard deviation of normal pseudorandom additions; |
center |
logical; if center=TRUE then the y -coordinates of prefractal points will be centered. |
Details
The Voss algorithm on 2D grid is based on an iterative partitioning of the initial domain into smaller subdomains by bilinear interpolation of additional points.
At each iteration, all values of the fractal Brownian function get normal pseudorandom additions with zero mean and standard deviation, which depends on the iteration index s[i]
.
By default, the iterative distribution of standard deviation in the generic version of the Voss algorithm is equal to the probability density of the chi-square distribution with 2 degrees of freedom: s[i] <- dchisq(i, df=2)
.
Value
A list of Cartesian coordinates of prefractal points.
Author(s)
Pavel V. Moskalev
References
Shitov V.V. and Moskalev P.V. Modification of the Voss algorithm for simulation of the internal structure of a porous medium //Technical Physics, Vol.50, No.2 (2005), pp.141-145.
See Also
voss1g, voss2d
Examples
# Example 1: FBF(x,y) with a s[i]=dchisq(i,df=2) set.seed(20120522) voss <- voss2g() image(voss, xlab="x", ylab="y", main="FBF(x,y) with a s[i]=dchisq(i,df=2)") contour(voss, levels=0, add=TRUE) # Example 2: FBF(x,y) with a s[i]=dlnorm(i,sdlog=1) set.seed(20120522) voss <- voss2g(p=cbind(n=0.5^-seq(0,7)+1, s=dlnorm(seq(0,7), sdlog=1))) image(voss, xlab="x", ylab="y", main="FBF(x,y) with a s[i]=dlnorm(i,sdlog=1)") contour(voss, levels=0, add=TRUE) # Example 3: FBF(x,y) with a s[i]=df(i,df1=7,df2=7) set.seed(20120522) voss <- voss2g(p=cbind(n=0.5^-seq(0,7)+1, s=df(seq(0,7), df1=7, df2=7))) image(voss, xlab="x", ylab="y", main="FBF(x,y) with a s[i]=df(i,df1=5,df2=5)") contour(voss, levels=0, add=TRUE)
Results
R version 3.0.2 (2013-09-25) -- "Frisbee Sailing" Copyright (C) 2013 The R Foundation for Statistical Computing Platform: x86_64-unknown-linux-gnu (64-bit) R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > library(Voss) Loading required package: fields Loading required package: spam Spam version 0.29-3 (2013-04-23) is loaded. Type 'help( Spam)' or 'demo( spam)' for a short introduction and overview of this package. Help for individual functions is also obtained by adding the suffix '.spam' to the function name, e.g. 'help( chol.spam)'. Attaching package: 'spam' The following objects are masked from 'package:base': backsolve, forwardsolve Loading required package: maps > png(filename="/home/oogasawa/snapshot/RGM3/R_CC/result/Voss/voss2g.Rd_%03d_medium.png", width=480, height=480) > ### Name: voss2g > ### Title: Fractal Brownian function on 2D grid with a generic Voss > ### algorithm > ### Aliases: voss2g > > ### ** Examples > > # Example 1: FBF(x,y) with a s[i]=dchisq(i,df=2) > set.seed(20120522) > voss <- voss2g() > image(voss, xlab="x", ylab="y", + main="FBF(x,y) with a s[i]=dchisq(i,df=2)") > contour(voss, levels=0, add=TRUE) > > # Example 2: FBF(x,y) with a s[i]=dlnorm(i,sdlog=1) > set.seed(20120522) > voss <- voss2g(p=cbind(n=0.5^-seq(0,7)+1, + s=dlnorm(seq(0,7), sdlog=1))) > image(voss, xlab="x", ylab="y", + main="FBF(x,y) with a s[i]=dlnorm(i,sdlog=1)") > contour(voss, levels=0, add=TRUE) > > # Example 3: FBF(x,y) with a s[i]=df(i,df1=7,df2=7) > set.seed(20120522) > voss <- voss2g(p=cbind(n=0.5^-seq(0,7)+1, + s=df(seq(0,7), df1=7, df2=7))) > image(voss, xlab="x", ylab="y", + main="FBF(x,y) with a s[i]=df(i,df1=5,df2=5)") > contour(voss, levels=0, add=TRUE) > > > > > > dev.off() null device 1 >
![]() ![]() ![]() |