how to generate an initial direction for a set of random points?

I'm simulating a kind of molecules'motion. The molecules are demonstrated by a large amount of point. But firstly, I have to give an initial direction for the large of points. What commands could be used in my situation? any ideas?

1 Kommentar

junwei - does each point have a different direction? What are the units for each direction (radians, degrees, or...)? Can the directions be random and so can you use randn?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

John BG
John BG am 12 Okt. 2015

0 Stimmen

you have, for each particle: direction=[direction_x direction_y direction_z] position=[position_x position_y position_z]
you generate movement by modifying position
for i=1:1:N for each particle position=position+direction.*i end end

Kategorien

Gefragt:

am 12 Okt. 2015

Beantwortet:

am 12 Okt. 2015

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by