back Solution to exercise 2.1.2 Dot and vector products of two vectors u and v can be caluclated using Octave built-in functions dot(u,v) and cross(u,v) respectively. <sxh c++> disp(“—————————————————————”) disp(“When giving vector coorinates enclose them in [], e.g. [1,23,3]”) disp(“—————————————————————”) u = input(“Give coorinates of vector U in R3 : ”); v = input(“Give coorinates of vector V in R3 : ”); d = dot(u,v); w = cross(u,v); disp(“Euclidean norms of vectors U and V, respectively:”) disp(norm(u)) disp(norm(v)) disp(“Scalar (dot) product of U and V:”) disp(d) disp(“Vector product of U and V:”) disp(w) </sxh> Download the script: dotcross.m en/teaching/subjects/it/labs/sol_2_1_2.txt Last modified: 2017/10/02 15:54(external edit)