Can I generate two correlated random fields in matlab
5 次查看(过去 30 天)
显示 更早的评论
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
corr.name = '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(KL.sv); % get the truncation level
W = randn(trunc,100);
F2 = repmat(KL.mean,1,100) + KL.bases*diag(KL.sv)*W;
Any answer is appreciated.
Best regards.
Jaime.
0 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!