Plotting Free Body Diagram for Scalar Triple Product in MATLAB

Click For Summary
SUMMARY

The discussion focuses on calculating the scalar triple product to determine the moment of a force vector about a specified line using MATLAB. The formula used is M = (r × F) ⋅ n, where r is the position vector, F is the force vector, and n is a unit vector. Participants provided code snippets for inputting vectors and checking if n is a unit vector, while also seeking guidance on plotting the Free Body Diagram. The solution involves using MATLAB functions such as dot and cross for calculations and requires proper formatting and labeling of the plot.

PREREQUISITES
  • Understanding of scalar triple product and its application in mechanics
  • Familiarity with MATLAB programming, specifically vector operations
  • Knowledge of plotting functions in MATLAB for graphical representation
  • Concept of unit vectors and their significance in physics
NEXT STEPS
  • Learn how to use MATLAB's plot function to create Free Body Diagrams
  • Research MATLAB's cross and dot product functions for vector calculations
  • Explore error handling in MATLAB to manage user input effectively
  • Study the concept of unit vectors and how to validate them in MATLAB
USEFUL FOR

Students in physics or engineering courses, MATLAB users working on vector calculations, and anyone interested in visualizing force systems through Free Body Diagrams.

raviyank
Messages
4
Reaction score
0

Homework Statement


[/B]
The scalar triple product computes the magnitude of the moment of a force vector about a specified line. It is M = ( r×F ) ⋅n , where is the position vector from the line to the point of application of the force and is a unit vector in the direction of the line. Prompt a user to enter (Fx,Fy ,Fz ), (rx, ry,rz ), and (nx,ny ,nz ); make sure, that is a unit vector and recalculate if necessary; then compute the magnitude for the case and plot the Free Body Diagram. The graph must be formatted and labelled by coding.

Homework Equations


[/B]= M = ( r×F ) ⋅n

The Attempt at a Solution


[/B]
i tried dot(n,cross(r,F)) for the main code but don't know how to plot free body diagram.
 
Last edited:
Physics news on Phys.org
Plot the free body diagram of what?

raviyank said:
dot(n,cross(r,F))
This should work. You could also consider
Matlab:
det([r,F,n])
assuming that r, F, and N are column matrices.
 
Moderator's note: two threads were merged, since they deal with the same question.

1. Homework Statement


The scalar triple product computes the magnitude of the moment of a force vector about a specified line. It is M = ( r× F) ⋅n , where is the position vector from the line to the point of application of the force and is a unit vector in the direction of the line. MATLAB: Prompt a user to enter (Fx,Fy ,Fz ), (rx, ry, rz), and (nx,ny ,nz ); make sure, that is a unit vector and recalculate if necessary; then compute the magnitude for the case and plot the Free Body Diagram. The graph must be formatted and labelled by coding.

2. Homework Equations

M = ( r× F) ⋅n

The Attempt at a Solution


clear;
sprinf('\nCalculating the Magnitude of M\n')
r = input ('\n Enter position vector r ');
F = input ('\n Enter Force vector F ');
While l
n = input ('\n Enter direction of the line "n" unit vector ');
N = 0;
for i = 1:1:3
N = N+n(i)^2;
end
N = round (sqrt(N),3);
if N ==1
break
end
sprintf ('\ n Error.n is not a unit vector.\n')
end

M = dot(cross(r,F),n)
M = [ M 0 0 ];Is this correct code? And I don't know how to plot free body diagram of this code..
 
Last edited by a moderator:

Similar threads

Replies
7
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 13 ·
Replies
13
Views
3K
Replies
3
Views
4K
  • · Replies 4 ·
Replies
4
Views
6K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 7 ·
Replies
7
Views
16K
  • · Replies 1 ·
Replies
1
Views
4K
  • · Replies 6 ·
Replies
6
Views
3K