From 16a2b71748b2b11e24f97da4fce86187152a5aa5 Mon Sep 17 00:00:00 2001 From: Michael Abed Date: Sat, 7 Apr 2012 21:41:05 -0400 Subject: up to date --- computeTrussCost.m | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 computeTrussCost.m (limited to 'computeTrussCost.m') diff --git a/computeTrussCost.m b/computeTrussCost.m new file mode 100755 index 0000000..df7daad --- /dev/null +++ b/computeTrussCost.m @@ -0,0 +1,15 @@ +function [ cost ] = computeTrussCost( C, X, Y ) + cost = 0; + [ j, m ] = size(C); + cost = cost + 10*j; + for i = 1:m + memb = C(:,i); + points = [X(memb == 1); Y(memb == 1)]; + d = dist(points(:,1), points(:,2)); + cost = cost + d; + 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 -- cgit v1.2.3