Use Matlab to write a function that computes the angle betwe

Use Matlab to write a function that computes the angle between vectors of finite dimensions when appropriate and gives an error otherwise.

Solution

solution ->

It is usually understood that the angle between two three-dimensional
vectors is measured by the shortest great circle path between them, which
means that it must lie between 0 and pi radians. To get such an answer,
the best method, in our opinion, is this:

angle = atan2(norm(cross(a,b)),dot(a,b));

Since the first argument must be non-negative, the angle will lie
somewhere in the two first quadrants, and thus be between 0 and pi. This
formula remains valid even if a and b are not unit vectors.

 Use Matlab to write a function that computes the angle between vectors of finite dimensions when appropriate and gives an error otherwise.Solutionsolution ->

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site