Advertisement
Guest User

Untitled

a guest
Mar 27th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 2.18 KB | None | 0 0
  1. %% Chapter 4 Part 1
  2.  
  3. %% Constants
  4. a = 1/sqrt(2);
  5. b = a^-1;
  6. %% Symbolics
  7. syms f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12;
  8. syms fh ful fur;
  9.  
  10. %% Homogeneous System
  11. % A is a coefficent matrix to the non-homogeneous linear system Ax=B.
  12. % Each row vector is from one of the joint equations.
  13. % The row vector order is [f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 f12 f13 fh ful fur]
  14. A = [a  1  0  0  0  0  0  0  0  0  0  0  0 -1  0  0;
  15.      a  0  0  0  0  0  0  0  0  0  0  0  0  0 -1  0;
  16.      0  1  0  0  0 -1  0  0  0  0  0  0  0  0  0  0;
  17.      0  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0;
  18.      a  0  0 -1 -a  0  0  0  0  0  0  0  0  0  0  0;
  19.      a  0  1  0  a  0  0  0  0  0  0  0  0  0  0  0;
  20.      0  0  0  1  0  0  0 -1  0  0  0  0  0  0  0  0;
  21.      0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0;
  22.      0  0  0  0  a  1  0  0 -a -1  0  0  0  0  0  0;
  23.      0  0  0  0  a  0  1  0  a  0  0  0  0  0  0  0;
  24.      0  0  0  0  0  0  0  0  0  1  0  0 -1  0  0  0;
  25.      0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0;
  26.      0  0  0  0  0  0  0  1  a  0  0 -a  0  0  0  0;
  27.      0  0  0  0  0  0  0  0  a  0  1  a  0  0  0  0;
  28.      0  0  0  0  0  0  0  0  0  0  0  a  1  0  0  0;
  29.      0  0  0  0  0  0  0  0  0  0  0  a  0  0  0 -1;]
  30. % B is the solution vector.
  31. B = [0; 0; 0; 12; 0; 0; 0; 0; 0; 16; 0; 20; 0; 0; 0; 0;]
  32.  
  33. %% Solution
  34. % The non-homogeneous linear system Ax=B describes the truss freebody.
  35. x = linsolve(A, B);
  36. %% Printing answers
  37. n = length(x);
  38. % Forces 1..13
  39. fprintf('Force solutions:\n');
  40. for k = 1:n-3
  41.     fprintf('f%d\t=\t%.4f\n', k, x(k));
  42. end
  43. % Forces up and horizontal
  44. fprintf('fh\t=\t%.4f\n', x(14));
  45. fprintf('ful\t=\t%.4f\n', x(15));
  46. fprintf('fur\t=\t%.4f\n', x(16));
  47. %% Force analysis
  48. v = x(1:13);                        % Only consider member forces
  49. i = find(v == max(v));              % Max tension
  50. j = find(v == min(v));              % Max compression
  51. m = find(abs(v) == max(abs(v)));    % Max stress
  52. k = find(abs(v) == min(abs(v)));    % Min stress
  53. fprintf('Member(s) under greatest tension:\n'); disp(i)
  54. fprintf('Member(s) under greatest compression:\n'); disp(j)
  55. fprintf('Member(s) under greatest stress:\n'); disp(m)
  56. fprintf('Member(s) under least stess:\n'); disp(k)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement