In MatLAB please The angle theta between two vectors u1 x1

In MatLAB please

The angle theta between two vectors u_1 = [x_1 y_1 z_1] and u_2 = [x_2 y_2 z_2] is theta = cos^-1 (x_1 x_2 + y_1 y_2 + z_1 z_2/||u_1||||u_2||), where ||u_i|| = Squareroot x_i^2 + y_i^2 + z_i^2. Given u_1 = [3.2 -6.8 9] and u_2 = [-4 2 7], compute the angle between them in degrees using element-by-element multiplication together with acosd, sum and squareroot .

Solution

Matlab code:

u1=[3.2 -6.8 9]

u2=[-4 2 7]

theta=acosd(sum(u1.*u2)/(sqrt(sum(u1.*u1))*sqrt(sum(u2.*u2))))

In MatLAB please The angle theta between two vectors u_1 = [x_1 y_1 z_1] and u_2 = [x_2 y_2 z_2] is theta = cos^-1 (x_1 x_2 + y_1 y_2 + z_1 z_2/||u_1||||u_2||),

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site