code problem of semivariogram

2 Ansichten (letzte 30 Tage)
vipul utsav
vipul utsav am 6 Jan. 2013
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?

Antworten (1)

Roger Stafford
Roger Stafford am 6 Jan. 2013
Bearbeitet: Roger Stafford am 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?
  1 Kommentar
vipul utsav
vipul utsav am 7 Jan. 2013
variogram(v)=(sum((z(x)-z(x+h))^2))/(2*m)
where, h is lag distance and m is number of pairs and z(x) and z(x+h) is a DN value at x and x+h location in row,,,here i have selected two row,,
and therefore m=2 pair for same lag distance,so i multipy sum with 0.5/2
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;
lam(i)=(0.5*l)/2; %(sum((z(x)-z(x+h))^2))/(2*m)
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');
i request to you if you have studied brief please provide me a correct code

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Elementary Math finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by