code problem of semivariogram
4 次查看(过去 30 天)
显示 更早的评论
clc;
close all;
clear all;
x=10+sqrt(50)*randn(400,1);
y=2+sqrt(30)*randn(400,1);
[a,b]=size(x);
d=a/40; %lag distance separation
num=a/d;
for i=1:num
l=(x(1)-x(d))^2+ (y(1)-y(d))^2+ (y(1)-y(d))^2;
lam(i)=(0.5*l)/3; %varigram calculation
di(i)=d;
d=d+10;
end
marker = 'o--';
plot(di,lam,marker);
axis([0 400 0 max(lam)*1.1]);
xlabel('h');
ylabel('\gamma (h)');
title('(Semi-)Variogram');
is this right way to calculate semivariogram of image?
0 个评论
回答(1 个)
Roger Stafford
2013-1-6
编辑:Roger Stafford
2013-1-6
Based on my brief reading of varigrams there appear to be a number of objections to this calculation. First, if your stochastic process is gaussian as indicated by your use of 'randn', the values obtained should be exact as for example is done in a variance computation, and not dependent on a random number generator. Second, the result should be a function of two variables, not one as you have here, particularly since your x and y variables possess different standard deviations. Third, the mean values are supposed to be removed before subtraction is done. Fourth, you have added (y(1)-y(d))^2 twice and I can see no reason for that. Fifth, why multiply by .5/3 ? What is the reason for that?
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!