Angle Between Vectors The angle
0<=\theta <=180\deg between two
n-dimensional real vectors
u,vinR^(n)can be determined through the relationship
cos\theta =(u*v)/(||u||||v||), where
u*v=u^(T)v=\sum_(i=1)^n u_(i)v_(i)is the standard dot product and
||u||=\sum_(i=1)^n \sqrt(u_(i)^(2))is the Euclidean (or
L_(2)) norm. Write a function vectorAngle( ) which takes as input: u,
n\times 1double array v,
n\times 1double array and returns as output: theta, the angle in degrees between
uand
v(note that the given equation is for
cos(\theta )) Assume
uand
vare non-zero vectors. Do not use loops in your solution. Example:
u=[1;0;0]
v=[0;1;1]
theta = vectorAngle (u,v)Output: theta
=90 IN MATLAB please!
