I need to create a method to generate a unit vector in three dimensions that points in a random direction using a random number generator. The distribution of direction MUST be isotropic.
Here is how I am trying to generate a random unit vector:
v = randn(1,3);
v = v./sqrt(v*v');
But I don't know how to complete the isotropic part. Any ideas?
相关问题
- Extract matrix elements using a vector of column i
- Unity - Get Random Color at Spawning
- How do you get R's null and residual deviance
- Set *both* elements and initial capacity of std::v
- How to display an image represented by three matri
相关文章
- why 48 bit seed in util Random class?
- How do I get characters common to two vectors in C
- How do I append metadata to an image in Matlab?
- How can I unpack (destructure) elements from a vec
- Need help generating discrete random numbers from
- How can I write-protect the Matlab language?
- `std::sin` is wrong in the last bit
- Escape sequence to display apostrophe in MATLAB
I don't know anything much about Matlab but it seems to me like you might try generating two random polar coordinates (theta and phi) and then converting them into Cartesian coordinates using trig.
You're doing it right. A random normal distribution of coordinates gives you a uniform distribution of directions.
To generate 10000 uniform points on the unit sphere, you run