Question: 1. Create a function named points2vector which outputs a 3D Cartesian vector given two 3D Cartesian coordinates. The function should: input: 2 variables of size

1. Create a function named points2vector which outputs a 3D Cartesian vector given two 3D Cartesian coordinates. The function should:

input: 2 variables of size (1,3) defining the points

output: 1 variable of size (1,3) defining the Cartesian vector

2. Create a function named vectorMagnitude which inputs a 3D Cartesian vector and determines its magnitude:

input: 1 variable of size (1,3) defining the Cartesian vector

output: 1 variable of size (1,1) defining the vector magnitude

3. Create a function named vector2unit which inputs a 3D Cartesian vector and converts it into a unit vector. The function should:

input: 1 variable of size (1,3) defining the Cartesian vector

output: 1 variable of size (1,3) defining the Cartesian unit vector

must use the function vectorMagnitude

4. Create a function named points2unit which converts two 3D points into a 3D Cartesian unit vector. The function should:

input: 2 variables of size (1,3) defining the coordinate points

output: 1 variable of size (1,3) defining the Cartesian unit vector

must use the functions point2vector and vector2unit

5. Create a program which tests the function points2unit, using a for loop. Complete the following chart:

The program must

Case p_head p_tail unit_vector
1 (5,1,3) (9,0,0)
2 (2,5,7) (4,-2,3)
3 (8,6, 3) (5,5,3)
4 (9,-1,-1) (6,-8,3)
5 (3,6,2) (8,1,7)
5 (1,1,3) (5,4,3)

use the points2unit function You cannot use the norm() or sum() functions. In addition, none of the functions should use the input() function.

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!