The moment of force applied may be calculated by the relationship M = r x F wher
ID: 3553841 • Letter: T
Question
The moment of force applied may be calculated by the relationship M = r x F where M is the moment, r is the vector from the point to where the force is applied and F is the force applied expressed as a vector. Consider the drawing below in which two force vectors, F1 and F2 are applied at point A.
Create a script *.m file that will prompt the user to enter the x,y,z components of the two forces, F1 and F2, and store these in two MATLAB row vectors (arrays). (You will probably find it easier to use two prompts, one for each force vector.) Next use prompt(s) to allow the user to enter the x,y,z values that represent the positions of A and G. Add the two force vectors to determine the resultant vector FR. Find the magnitude of FR by taking the square root of the sum of the squares of the FR components. (Mag = (Mag = (FRx2 + FRy2 + FRz2)
Explanation / Answer
Code:
%%
function [M, Mag] = Moment()
x = inputdlg({'Enter in a space-separated way, the components of Force Vector 1:','Enter in a space-separated way, the components of Force Vector 2:'}, 'Force Vectors', [1 80; 1 80]);
y = inputdlg({'Enter in a space-separated way, the components of A:','Enter in a space-separated way, the components of G:'}, 'Position Vectors', [1 80; 1 80]);
F1 = str2num(x{1});
F2 = str2num(x{2});
A = str2num(y{1});
G = str2num(y{2});
FR = F2 - F1;
r = A-G;
M = cross(r, FR);
Mag = sqrt(sum(FR(:).^2));
%%
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.