From 4d6abebe7d7ee44053c3cbacf779d664a704f4c6 Mon Sep 17 00:00:00 2001 From: Michael Abed Date: Sun, 1 Apr 2012 15:58:32 -0400 Subject: working --- computeA.m | 9 +++++---- truss_solve.m | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 4 deletions(-) create mode 100755 truss_solve.m diff --git a/computeA.m b/computeA.m index aa1ca08..b3c9478 100755 --- a/computeA.m +++ b/computeA.m @@ -15,13 +15,14 @@ function [ A ] = computeA( C, X, Y, Sx, Sy ) end end end - A(m+1:m+3,1:j)=Sx; - A(m+1:m+3,j+1:2*j)=Sy; + A(1:j,m+1:m+3)=Sx; + A(j+1:2*j,m+1:m+3)=Sy; end function [ p ] = findother(col, row) - for i = 1:size(col) - if col(i) ~= row && col(i) + p = 0; + for i = 1:length(col) + if col(i) && i ~= row p = i; end end diff --git a/truss_solve.m b/truss_solve.m new file mode 100755 index 0000000..50150bb --- /dev/null +++ b/truss_solve.m @@ -0,0 +1,26 @@ +% Truss Compute + +C = [ + 1 1 0 0 0 0 0 0 0 0 0 0 0 + 1 0 1 1 0 0 0 0 0 0 0 0 0 + 0 0 0 1 1 1 0 0 0 0 0 0 0 + 0 1 1 0 1 0 1 1 0 0 0 0 0 + 0 0 0 0 0 1 1 0 1 1 0 0 0 + 0 0 0 0 0 0 0 1 1 0 1 1 0 + 0 0 0 0 0 0 0 0 0 1 1 0 1 + 0 0 0 0 0 0 0 0 0 0 0 1 1 +]; + +Sy = zeros(8,3); Sy(1,2)=1; Sy(8,3)=1; +Sx = zeros(8,3); Sx(1,1)=1; + +X = [0 0 4 4 8 8 12 12]; +Y = [0 4 8 4 8 4 4 0]; + +L = zeros(16,1); L(8+4)=-25; + +A = computeA(C,X,Y,Sx,Sy); + +result = A\(-L) + + -- cgit v1.2.3