Write a user-defined MATLAB function that determines the unit vector in the direction of the line that

Question:

Write a user-defined MATLAB function that determines the unit vector in the direction of the line that connects two points (A and B) in space. For the function name and arguments, use n = unitvec (A, B). The inputs to the function are two vectors A and B, each with the Cartesian coordinates of the corresponding point. The output is a vector with the components of the unit vector in the direction from A to B. If points A and B have two coordinates each (they are in the x y plane), then n is a two-element vector. If points A and B have three coordinate each (general points in space), then n is a three-element vector. Use the function to determine the following unit vectors:
(a) In the direction from point (1.2, 3.5) to point (12, 15)
(b) In the direction from point (-10, -4, 2.5) to point (-13, 6, -5)
Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: