I am currently working with the functions avaiable at Random Field Simulator. I have been able to follow the examples and generate some two-dimensional gaussian random fields using the KL expansion. However, I also need to generate a second random field correlated to the first one (these are suposed to represent zonal and meridional winds). I don't know how to do this. Can someone please tell me if they have worked with this software and if it is possible to generate a second correlated process?
This is the code I am using in the same folder as the two downloaded functions from Random Field Simulator in case someone wants to take a look.
corr.name = 'gauss';
corr.c0 = [0.7 0.1];
x = linspace(0,1,numberOfPoints);
[X,Y] = meshgrid(x,x); mesh = [X(:) Y(:)];
corr.sigma = cos(pi*mesh(:,1)).*sin(2*pi*mesh(:,2))+1.5;
[F,KL] = randomfield(corr,mesh,'trunc', 20, 'filter', 1);
trunc = length(KL.sv);
W = randn(trunc,100);
F2 = repmat(KL.mean,1,100) + KL.bases*diag(KL.sv)*W;
Any answer is appreciated.