summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.gitignore2
-rwxr-xr-xmemberDistances.m15
-rwxr-xr-xweakestMember.m2
3 files changed, 18 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100755
index 0000000..e89c489
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+
+*.*~
diff --git a/memberDistances.m b/memberDistances.m
new file mode 100755
index 0000000..bd51f3d
--- /dev/null
+++ b/memberDistances.m
@@ -0,0 +1,15 @@
+function [ D ] = memberDistances(C, X, Y)
+ [ ~, m] = size(C);
+ D = zeros(m,1);
+ for i = 1:m
+ memb = C(:,i);
+ points = [X(memb == 1); Y(memb == 1)];
+ D(i) = dist(points(:,1), points(:,2));
+ end
+
+end
+
+
+function [ d ] = dist(p1, p2)
+ d = sqrt((p1(1)-p2(1))^2+(p1(2)-p2(2))^2);
+end \ No newline at end of file
diff --git a/weakestMember.m b/weakestMember.m
index 6b67d64..7b95542 100755
--- a/weakestMember.m
+++ b/weakestMember.m
@@ -5,7 +5,7 @@ function [ idx ] = weakestMember(D, T)
p(p > 0) = 0;
a = 1:length(D);
- [~,i] = max(abs(p));
+ [~,i ] = max(abs(p));
idx = a(i);
end