Generate a matrix meant to be used as one direction of a random flow field.

randomflowfield(n, m, std_dev)

Arguments

n

Zonal (x) extent of the flow field.

m

Meridional (y) extent of the flow field.

std_dev

Standard deviation used for the random walk, see details.

Value

A matrix meant to be used as one direction of a random flow field.

Details

This function proceeds in the following way: A starting value, either 1 or -1, is drawn at random. This is assigned to the element in the top-left corner of the matrix. The other values are then calculated as the sum of a normal random variable with standard deviaton std\_dev and their left neighbour (top row) or the mean of their left and their upper neighbour (rest).

See also

Author

Thorsten Lenser

Examples


U = randomflowfield(30,30,0.3)
V = randomflowfield(30,30,0.3)
quiver(U,V)