Advertisement
shamzed

cornerstone project

Jan 1st, 2023
220
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.46 KB | None | 0 0
  1. % Variables
  2.  
  3. r_out = input("Please type in the value of outer radius (m): ");
  4. r_in = input("Please type in the value of inner radius (m): ");
  5. F = input("Please type in the value of force (N): ");
  6. d1 = input("Please type in the value of distance 1 (m): ");
  7. d2 = input("Please type in the value of distance 2 (m): ");
  8. len = input("Please type in the value of length (m): ");
  9. % r_out = 0.015; r_in = 0.01;
  10. % F = 900; len = 0.2;
  11. % d2 = 0.25; d1 = 0.15;
  12.  
  13. % Main code
  14. I = (pi / 4) * (r_out^4 - r_in^4);
  15. J = (pi / 2) * (r_out^4 - r_in^4);
  16.  
  17. M_y = F * (d2 - d1);
  18. M_x = 2 * len * F;
  19.  
  20. tau_xy = (M_x * r_out) / J;
  21. sigma_x = -(M_y * r_out) / I;
  22. sigma_y = 0;
  23.  
  24. % principal stresses
  25. sigma_2 = ((2 * F * r_out) / (pi * (r_out^4 - r_in^4))) * ((d1 - d2) + sqrt(((d1 - d2)^2) + (4 * len^2)));
  26. fprintf("Sigma 2: %.2f MPa\n", sigma_2/10^6)
  27. sigma_1 = ((2 * F * r_out) / (pi * (r_out^4 - r_in^4))) * ((d1 - d2) - sqrt(((d1 - d2)^2) + (4 * len^2)));
  28. fprintf("Sigma 1: %f MPa\n", sigma_1/10^6)
  29.  
  30. theta = (180 / pi) * 0.5 * atan((tau_xy) / (sigma_x/2));
  31. fprintf("The principal angle is : %.2f, %.2f", theta, theta + 180);
  32.  
  33. angles = 0: 0.01: (2 * pi);
  34. sigma_x_prime = (0.5 * (sigma_x + sigma_y)) + (0.5 * cos(2 * angles) * (sigma_x - sigma_y)) + tau_xy * sin(2 * angles);
  35. sigma_y_prime = (0.5 * (sigma_x + sigma_y)) - (0.5 * cos(2 * angles) * (sigma_x - sigma_y)) - tau_xy * sin(2 * angles);
  36. angles = angles * (180/ pi);
  37. plot(angles, (sigma_x_prime / 10^6), angles, (sigma_y_prime / 10^6));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement