Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: Random 3-D Walk
Replies: 1   Last Post: Oct 21, 2012 10:34 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
ImageAnalyst

Posts: 12,932
Registered: 12/26/06
Re: Random 3-D Walk
Posted: Oct 21, 2012 10:34 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Michael
Have a for loop over the number of steps you want to take, say a thousand or so but start with around 10 or 20 while you're still developing and debugging it. Then inside the loop get random numbers with rand() and add it to the x and y coordinate values. Then use an if statement to see if adding that random number would put the particle on the other side of the barrier. If it would, change the coordinate to what it would be as if it had bounced off that barrier.


Date Subject Author
10/20/12
Read Random 3-D Walk
Michael
10/21/12
Read Re: Random 3-D Walk
ImageAnalyst

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.