TwentyEight

4 L4N<3 4CES

Jan 11th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.45 KB | None | 0 0
  1. % This is a comment; to write a comment, you have to start the line with a '%'.
  2. % I will painstakingly do this question on MATLAB in detail for you.
  3. % We start with the RHS, and denote the forces A and B respectively.
  4. F_A = 30; %The magnitude of the force in Newtons
  5. F_B = 120;
  6. A_x = -7;
  7. A_y = -1; %The directions of F_A. Negative because it is pointing left and down.
  8. B_x = 1;
  9. B_y = 5;
  10. F_A_x = F_A * A_x / sqrt(A_x^2 + A_y^2); %The x-direction component of F_A.
  11. % Found by scaling the triangle given in the x-direction. If still confusing ask me.
  12. F_A_y = F_A * A_y / sqrt(A_x^2 + A_y^2);
  13. F_B_x = F_B * B_x / sqrt(B_x^2 + B_y^2);
  14. F_B_y = F_B * B_y / sqrt(B_x^2 + B_y^2);
  15. % Notice the similarity in the expressions written above ^.
  16. % I have written these out in full, but there is a quicker way to do all these repetitive functions on MATLAB!
  17. rhsF_x = F_A_x + F_B_x;
  18. rhsF_y = F_A_y + F_B_y;
  19. rhsF = sqrt(rhsF_x^2 + rhsF_y^2)
  20. % I have written this command without a ';' so the result is printed out
  21. % The part below is beyond the scope of what you should be able to understand on MATLAB
  22. % But I repeat the process of getting x- and y- components for the LHS force, then compare with RHS force to find F
  23. syms F;
  24. expr_x = F * -cosd(17) + 2*F*cosd(27);
  25. expr_y = F * sind(17) + 2*F*sind(27);
  26. expr_F = sqrt(expr_x^2 + expr_y^2);
  27. assume(F > 0);
  28. % The below is the final answer, so I have chosen not to suppress the result.
  29. solF = double(solve(expr_F == rhsF, F))
Add Comment
Please, Sign In to add comment