frgmsonly

Oving5

Sep 23rd, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.52 KB | None | 0 0
  1. tic
  2.  
  3. L = 40;             %length of beam in m
  4. b = 10;             %distance between forces in m
  5. P_1 = 200;          %force in kN
  6. P_2 = 300;          %force in kN
  7.  
  8. %x-coord of P_1 in m
  9. x = linspace(-b,L,500);
  10.  
  11. %deflection * EI at the middle of the beam due to P_1
  12. d_1 = zeros(1,length(x));
  13.  
  14. %d_1*EI when P_1 is located before the middle of the beam
  15. d_1( (x<L/2) & (x>=0)) = P_1 .* x( x<L/2 & x>=0) .* (L/2) .* ...
  16.     (L^2-x( x<L/2 & x>=0 ) .^2 -(L/2)^2) ./ (6*L);
  17.  
  18. %d_1*EI when P_1 is located at or after the middle of the beam
  19. d_1(x>=L/2 & x<=L) = P_1 .*(L-x(x>=L/2 & x<=L)) .* (L/2) .* ...
  20.     (L^2 - (L - x(x>=L/2 & x<=L)).^2 -(L/2)^2) ./ (6 .* L);
  21.  
  22. %deflection * EI at the middle of the beam due to P_2
  23. d_2 = zeros(1,length(x));
  24.  
  25. %d_2*EI when P_2 is located before the middle of the beam
  26. d_2( (x+b<L/2) & (x+b>=0)) = P_2 .* (x( x+b<L/2 & x+b>=0)+b) .* (L/2) .* ...
  27.     (L^2-(x( x+b<L/2 & x+b>=0 )+b) .^2 -(L/2)^2) ./ (6*L);
  28.  
  29. %d_2*EI when P_2 is located at or after the middle of the beam
  30. d_2(x+b>=L/2 & x+b<=L) = P_2 .*(L-(x(x+b>=L/2 & x+b<=L)+b)) .* (L/2) .* ...
  31.     (L^2 - (L - (x(x+b>=L/2 & x+b<=L)+b)).^2 -(L/2)^2) ./ (6 .* L);
  32.  
  33. %deflection*EI of the beam at the center if there was no support at B
  34. d_3 = d_1 + d_2;
  35.  
  36. %Support B is added back in as an upward force that makes the deflection zero
  37. %at the centre of the beam
  38. B_z = 48 .* d_3 ./ L^3;
  39.  
  40. plot(x,B_z,'-b')
  41. hold on
  42.  
  43. [a,I] = max(B_z);
  44.  
  45. %the value of x that gives the max value for B_z
  46. max_x = x(I)
  47.  
  48. plot(max_x,a,'xk','MarkerSize',15)
  49.  
  50. toc
Advertisement
Add Comment
Please, Sign In to add comment