summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Abed <michaelabed@gmail.com>2012-04-07 23:15:25 -0400
committerMichael Abed <michaelabed@gmail.com>2012-04-07 23:25:55 -0400
commit26c2bfa7a7d02286be61a7044d581f31d4f7938f (patch)
tree5087202cb1c87180d75cf5e7f3aa2d47f5c8dbb9
parent81117fb87ae3edb8b7bb31962f52b8c85af431fa (diff)
downloadek301-prelim-26c2bfa7a7d02286be61a7044d581f31d4f7938f.tar.gz
ek301-prelim-26c2bfa7a7d02286be61a7044d581f31d4f7938f.tar.bz2
ek301-prelim-26c2bfa7a7d02286be61a7044d581f31d4f7938f.zip
memberdistance and gitignore
-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