diff options
Diffstat (limited to 'truss_solver.m')
-rwxr-xr-x | truss_solver.m | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/truss_solver.m b/truss_solver.m new file mode 100755 index 0000000..4a7a1aa --- /dev/null +++ b/truss_solver.m @@ -0,0 +1,27 @@ + +filename = input('Input truss data-file name: ', 's'); + +run(filename); + +forces = solveTruss(C, Sx, Sy, X, Y, L); +forces(abs(forces) < 0.00001) = 0; +[j, m] = size(C); + +Ln = L(L~=0); +for i = 1:length(Ln) + + fprintf('Load: %.3f N\n', abs(Ln(i))); +end +fprintf('Member forces in Newtons:\n'); +for i = 1:m + printForce(forces, i); +end +fprintf('Reaction forces in Newtons\n'); +for i = 1:length(forces)-m + fprintf('r%d: %.3f\n', i, forces(m+i)); +end + +cost = computeTrussCost(C, X, Y); +fprintf('Cost of truss: $%d\n', round(cost)); + +fprintf('Theoretical max load/cost ratio in N/$: %.4f\n', abs(sum(L))/cost);
\ No newline at end of file |