3. Vectors A and B are applied at the origin. A-3/ +j B = i + 4j what is the ang
ID: 3724815 • Letter: 3
Question
3. Vectors A and B are applied at the origin. A-3/ +j B = i + 4j what is the angle, , between A and B? Report your answer to the nearest tenth of a degree. a. Design a function such that when two vectors A and B (defined as two 1 x 2 matrices) are used as the input and the output is the angle in degrees between A and B. Input. A = [A. A], B= [B, BI Output: angle in degrees between A and B Solve the above problem using a graph and your calculator, then plug the problem into your Matab function and compare results.Explanation / Answer
The dot product of A and B
ABcos(x) = -3*1 + 1*4
sqrt((3*3 + 1)(1 + 4*4))*cos(x) = 1
cos(x) = 1 / sqrt(170)
x = acos(1/sqrt(170))
x = 85.6degrees
The corresponding function in MATLAB is defined as follows
function theta = angle(A ,B)
d = dot(A, B);
c = sqrt(sum(A.^2) * sum(B.^2));
theta = acos(d / c) * 180 / acos(-1);
end
a = [-3 1];
b = [1 4];
angle(a,b)
ans = 85.601
Best regards
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.