Exercise 1.2.34

Using v = randn (3,1) in MATLAB, create a random unit vector u = vv. Using V = randn (3,30) create 30 more random unit vectors Uj. What is the average size of the dot products |uUj| ? In calculus, the average is 0π|cos 𝜃|d𝜃π = 2π.

Answers

The commands

V = randn(3,30); 
D = sqrt(diag(V’ * V)); 
U = V \ D;

will give 30 random unit vectors in the columns of U. Then u U is a row matrix of 30 dot products whose average absolute value should be close to 2π.

User profile picture
2021-11-20 14:12
Comments