Can I generate two correlated random fields in matlab

조회 수: 6(최근 30일)
Jaime De La Mota Sanchis
Jaime De La Mota Sanchis 2021년 8월 2일
Hello everyone.
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.
% % build the correlation struct = 'gauss';
corr.c0 = [0.7 0.1]; % anisotropic correlation
numberOfPoints=51;%number of points in a square of size 1
x = linspace(0,1,numberOfPoints);
[X,Y] = meshgrid(x,x); mesh = [X(:) Y(:)]; % 2-D mesh
% set a spatially varying variance (must be positive!)
corr.sigma = cos(pi*mesh(:,1)).*sin(2*pi*mesh(:,2))+1.5;
[F,KL] = randomfield(corr,mesh,'trunc', 20, 'filter', 1);
trunc = length(; % get the truncation level
W = randn(trunc,100);
F2 = repmat(KL.mean,1,100) + KL.bases*diag(*W;
Any answer is appreciated.
Best regards.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by