• Support PF! Buy your school textbooks, materials and every day products Here!

Triple product in matlab

  • #1
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
16,815
6,610
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
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:

Related Threads on Triple product in matlab

  • Last Post
Replies
3
Views
2K
  • Last Post
Replies
14
Views
4K
  • Last Post
Replies
1
Views
1K
Replies
1
Views
992
  • Last Post
Replies
3
Views
1K
  • Last Post
Replies
0
Views
5K
  • Last Post
Replies
0
Views
4K
  • Last Post
Replies
7
Views
11K
Replies
3
Views
993
Replies
1
Views
2K
Top