You are on page 1of 1

y=[0.3 0.34 0.2 0.24 0.28 0.2 0.02 0.06 0.37 0.36 0.30 0.30 0.14 0.

15]
x=[1 1 2 2 3 3 4 4 1 1 3 3 5 5]
n1=length(x)
n2=length(y)
rep=100;
sum=0
for i= 1:rep
x1=randsample(x,n1,true);
y1=randsample(y,n2,true);
meanx=mean(x1);
meany=mean(y1);
stx = std(x1);
sty = std(y1);
for i=1:n1
sum = sum + (x1(i)-meanx)*(y1(i)-meany);
kor= sum /((rep-1)*stx*sty);
end
end
kor = sum /rep

You might also like