# Autocorrelated random field generation

Problem is related with my other question

So, generate exponentially correlated row $$π₯_{0,0},π₯_{1,0}...π₯_{π,0}$$ and starting from π₯0,0 there will be a correlated column $$π₯_{0,1},π₯_{0,2}...π₯_{0,n}$$.

During generation we used a correlation $$π=ππ₯π(βΞπ/π)$$. And $$π₯_{π,0}=\sqrt{1βπ^2}Rand[NormalDistribution[π,π]]+π π₯_{πβ1,0}$$

So...During 2 dimensions it should be $$π=ππ₯π(βΞππ₯/ππ₯βΞππ¦/ππ¦)$$. And in isotropic space $$π=ππ₯π(β2Ξπ/π)$$.

But how to generate $$π₯_{1,1}$$ correctly with this $$π$$? This one with square mean looks absolutely wrong: $$π₯_{1,1}=\sqrt{1βπ2}Rand[NormalDistribution[π,π]]+π\sqrt{π₯_{1,0} π₯_{0,1}}$$

Tried to generate with arithmetic mean: $$π₯_{1,1}=\sqrt{1βπ2}Rand[NormalDistribution[π,π]]+π(π₯_{1,0}+ π₯_{0,1})/2$$ But it look not correlated in Y direction... Any way to make it better?

my code:

ΞΌ = 0; Ο = 1; ΞΎ = 10; Ο = 1; l = {{0, 0,
RandomVariate[NormalDistribution[ΞΌ, Ο],
1][[1]]}}; size = 100; Ο = E^(-(
Abs[Ο]/ΞΎ)); Ο2 = E^(-2 Abs[Ο]/ΞΎ);
For[j = 1, j < size, j++,
Subscript[x, 0] = {l[[1, 3]]};
Subscript[x,
j] = Ο2 Subscript[x, j - 1][[1]] +
Sqrt[1 - Ο2^2]
RandomVariate[NormalDistribution[ΞΌ, Ο], 1];
AppendTo[l, {j, 0, Subscript[x, j][[1]]}]];

For[i = 1, i < size, i++,
Subscript[x,
0] = Ο2 l[[1 + size (i - 1), 3]] +
Sqrt[1 - Ο2^2]
RandomVariate[NormalDistribution[ΞΌ, Ο], 1];
AppendTo[l, {0, i, Subscript[x, 0][[1]]}];
For[j = 1, j < size, j++,
Subscript[x,
j] = Ο2 (Subscript[x, j - 1][[1]] + l[[size i + j, 3]])/2 +
Sqrt[1 - Ο2^2]
RandomVariate[NormalDistribution[ΞΌ, Ο], 1];
AppendTo[l, {j, i, Subscript[x, j][[1]]}]]];
ListContourPlot[l]
ListPlot3D[l]

• The standard way to generate correlated noise, is to: 1) Compute the autocorrelation function; 2) Fourier Transform this to get the Power spectrum; 3) Generate independent random numbers; 4) scale by the sqrt of the Power spectrum; 5) Fourier transform; 6) Verify that you have the autocorrelation function you wanted. (This will work in any number of dimensions) Mar 9, 2019 at 22:24
• @mikado: Not sure where I heard this many years ago: "We must love standards because we have so many of them." For me the standard way for this problem is to generate random samples directly from a multivariate normal with the desired covariance structure.
– JimB
Mar 9, 2019 at 23:03
• @JimB if I want to generate (say) a 1000x1000 image of correlated noise, my method involves generating 10^6 random samples, weighting each one with a simple function and 2D FFT (quick). Yours involves generating a 10^6 x 10^6 covariance matrix. Mathematica would struggle to generate the resulting random vector. Mar 9, 2019 at 23:37
• @mikado Yep, there would be a bit of a struggle. My weak/feeble defense is that I didn't see the OP state any size requirements.
– JimB
Mar 9, 2019 at 23:42

n = 100;