How can I map a Gaussian vector according to an equation that has a spatial autocorrelation function?
1 回表示 (過去 30 日間)
古いコメントを表示
I have the following function:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/205524/image.png)
I want to run some Monte Carlo simulations and at each simulation I have to generate new values of E at certain locations x and z. So basically I will have to generate a grid of points with coordinates
and
where I will evaluate E.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/205525/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/205526/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/205527/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/205528/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/205529/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/205530/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/205531/image.png)
I know how to generate the vector Y if it has no correlation but I'm not sure how to do it with the autocorrelation function, I did the following but I'm not sure if this is correct:
Generated a grid of points (pts), code below:
x=-50:1:50;
z=0:1:20;
pts=zeros(length(x)*length(z),2);
for i=1:length(x)
for j=1:length(z)
pts((length(z)*(i-1)+1)+j-1,:)=[x(i),z(j)];
end
end
Generated a correlation matrix from the correlation function, code below:
cormat=zeros(length(pts),length(pts));
for i=1:length(pts)
for j=i:length(pts)
dx=pts(i,1)-pts(j,1);
dy=pts(i,2)-pts(j,2);
cormat(i,j)=exp(-abs(dx)/10.-abs(dy)/3.);
end
end
Generated a covariance matrix from the correlation matrix:
cormat=cormat'+cormat-eye(length(pts));
stdmat=eye(length(pts));
covmat=stdmat*cormat*stdmat;
Evaluated the function Y using MATLAB function mvnrnd:
y=mvnrnd(ones(1,length(pts)),covmat);
0 件のコメント
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Curve Fitting Toolbox についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!