Please answer the question and tell me the name of the book


Please answer the question and tell me the name of the book you found the questions in.

Modify the orthog program so that it accepts a pair of three-dimensional vectors and outputs the unit vector that is orthogonal to the input vectors.

Solution

clear all; help orthog;   % Clear the memory and print header
%* Initialize the vectors a and b
a = input(\'Enter the first vector: \');
b = input(\'Enter the second vector: \');
%* Evaluate the dot product as sum over products of elements
a_dot_b = 0;
for i=1:3
a_dot_b = a_dot_b + a(i)*b(i);
end
%* Print dot product and state whether vectors are orthogonal
if( a_dot_b == 0 )
disp(\'Vectors are orthogonal\');
else
disp(\'Vectors are NOT orthogonal\');
fprintf(\'Dot product = %g \ \',a_dot_b);
end
% for finding the orthogonal vector%
C = cross(a,b);
c = sqrt(dot(C,C));
C\' = C./c

 Please answer the question and tell me the name of the book you found the questions in. Modify the orthog program so that it accepts a pair of three-dimensiona

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site