code problem of semivariogram
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Roger Stafford
on 6 Jan 2013
Edited: Roger Stafford
on 6 Jan 2013
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?
See Also
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!