Triple product in matlab

  • #1
raviyank
4
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:

Answers and Replies

  • #2
Orodruin
Staff Emeritus
Science Advisor
Homework Helper
Insights Author
Gold Member
2021 Award
19,553
9,934
Plot the free body diagram of what?

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.
 
  • #3
raviyank
4
0
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:

Suggested for: Triple product in matlab

  • Last Post
Replies
10
Views
143
  • Last Post
Replies
1
Views
76
  • Last Post
Replies
3
Views
375
  • Last Post
Replies
1
Views
409
  • Last Post
Replies
0
Views
315
  • Last Post
Replies
1
Views
558
Replies
5
Views
682
  • Last Post
Replies
1
Views
370
  • Last Post
Replies
2
Views
1K
Top