Question: Mathematically, if u = (u_1, u_2, u_3), v = (v_1, v_2. v_3), and w(w_1, w_2, w_3) are three vectors in R^3, the cross product of

 Mathematically, if u = (u_1, u_2, u_3), v = (v_1, v_2.

Mathematically, if u = (u_1, u_2, u_3), v = (v_1, v_2. v_3), and w(w_1, w_2, w_3) are three vectors in R^3, the cross product of two vectors defined to be the vector u times v = (u_2v_3 - u_3v_2, - u_1v_3 + u_3v_1 - u_1v_2 - u_2v_1) and the triple product is defined to be the scalar value (u times v) middot w = u_1v_2w_3 + u_2v_3w_1 + u_3v_1w_2 - u_3v_2w_1 = u_1v_3w_2 - u_2v_1w_3. Suppose we represent a vector in R^3 as a Matlab struct variable with three fields: xcomp, y comp, and zcomp. For example, the vector u described above would have u.x comp = u_1, u.y comp = u_2, and u.z comp = u_3. Write a Matlab function called vectorprod.m that determines the cross-product of two vectors when called with 2 input values, or the triple product of three vectors when called with 3 input values. Each of the input values must be a struct with the three fields listed above. Your function must return the cross product as a struct variable with the same fields. The triple product can be return as simply a number (not a struct). You can test your function using the vectors I have provided in the file vectorprodtestvals.mat

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!