Wednesday 21 August 2013

Overlap between two vectors in Matlab

Overlap between two vectors in Matlab

I have such table:
x y Z w
u1 0 0 2 2
u2 1 0 1 2
u3 3 0 0 3
u4 2 2 5 9
u5 0 3 1 4
I want to calculate overlap between two rows. My Matlab code is :
for j = 1:6
x = data(j,:);
for i = j+1:7
y = data(i,:);
a = sum(max(x,y));
b = sum(min(x,y));
d = sqrt(b);
over = d/a;
end
end
but I want to show the overlap between rows in the result? For example,
overlap(1,2) represents the overlap between the first and second rows. And
so on. Result is: overlap(1,2)=? overlap(1,3)=? overlap(1,4)=? ...
overlap(2,3)=? overlap(2,4)=? ... What do I need to make this change to
the code?

No comments:

Post a Comment