Question

The angle between two vectors u1=x1i+y1j+z1k and u2=x2i+y2j+z2k can be determined by cos()=(x1*x2+y1*y2+z1*z2)/(|u1|*|u2|), were |u1|=sqrt(x1^2+y1^2+z1^1). Given...

The angle between two vectors u1=x1i+y1j+z1k and u2=x2i+y2j+z2k can be determined by cos(\Theta)=(x1*x2+y1*y2+z1*z2)/(|u1|*|u2|), were |u1|=sqrt(x1^2+y1^2+z1^1). Given the vectors u1=3.2i-6.8j+9k and u2=-4i+2j+7k, determine the angle between them (in degrees) by writing one MATLAB command that uses element by element multiplication and the MATLAB built in functions acosd, sum, and sqrt.

This is what I tried but i don't think it's correct because it should be one value and I got a vector

u1=[3.2 -6.8 9] u2=[-4 2 7] theta=acosd(sum(u1.*u2)./sqrt(u1).*sqrt(u2)).

0 0
Add a comment Improve this question Transcribed image text
Answer #1

clc
clear all

u1 = [ 3.2, -6.8, 9 ];
u2 = [ -4, 2, 7 ];

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

fprintf('\ntheata = %0.4f degree\n',theta);

Add a comment
Know the answer?
Add Answer to:
The angle between two vectors u1=x1i+y1j+z1k and u2=x2i+y2j+z2k can be determined by cos()=(x1*x2+y1*y2+z1*z2)/(|u1|*|u2|), were |u1|=sqrt(x1^2+y1^2+z1^1). Given...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT