MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayNew to MATLAB?
MATLAB Central > MATLAB Newsreader > Matlab 3d Walk problem 

Subject: Matlab 3d Walk problem From: Justin Twardowski Date: 19 Nov, 2010 01:16:03 Message: 1 of 18 
Hi everyone. So, I'm currently taking a physics course which happens to involve a computer project; the project is a statistical analysis of a 3dimensional random walk (each step being the same length and random in x,y,and z orientations). I'm fairly new to Matlab (I originally learned programming a couple years ago in C, but most of that has since been forgotten). 
Something like this perhaps, where the positions visited are recorded, rather than the steps. 
Subject: Matlab 3d Walk problem From: Justin Twardowski Date: 19 Nov, 2010 02:13:04 Message: 3 of 18 
Okay, so I understand conceptually what you mean, but I get lost in the code. Right now, here is what I have: 
Subject: Matlab 3d Walk problem From: Justin Twardowski Date: 19 Nov, 2010 02:34:05 Message: 4 of 18 
Nevermind, what you posted makes perfect sense and is a lot more efficient than what I had. Thank you. 
No problem. Here is an alternative method which forms the random steps, then uses cumsum to get the resultant positions 
Subject: Matlab 3d Walk problem From: Justin Twardowski Date: 19 Nov, 2010 19:09:04 Message: 6 of 18 
That method seems better. For this project, I'm supposed to run through data sets for the number of steps being 100, 1000, 10000 and 100000 so it was taking a while to run. MY question now is, would there be a way to just return the final value instead of the value after each iteration? That would be much easier to work with when I have to run my data analysis. 
"Justin Twardowski" <jtwardow@email.arizona.edu> wrote in message <ic6i0g$o8e$1@fred.mathworks.com>... 
"Darren Rowland" <darrenjremovethisrowland@hotmail.com> wrote in message <ic53un$jf2$1@fred.mathworks.com>... 
Subject: Matlab 3d Walk problem From: Justin Twardowski Date: 21 Nov, 2010 01:41:03 Message: 9 of 18 
"Roger Stafford" <ellieandrogerxyzzy@mindspring.com.invalid> wrote in message <ic6vho$3rn$1@fred.mathworks.com>... 
Subject: Matlab 3d Walk problem From: Justin Twardowski Date: 21 Nov, 2010 01:55:04 Message: 10 of 18 
I thought I should specify how I need my data to be returned. The other main quantity being examined is the mean displacement squared; that's why I'm assuming an array of the vector steps would be nice to work with. Thanks to everyone, again. 
"Justin Twardowski" <jtwardow@email.arizona.edu> wrote in message <ic9u5o$bkb$1@fred.mathworks.com>... 
Subject: Matlab 3d Walk problem From: Justin Twardowski Date: 21 Nov, 2010 16:38:03 Message: 12 of 18 
Hi Roger, 
Subject: Matlab 3d Walk problem From: Justin Twardowski Date: 21 Nov, 2010 18:42:03 Message: 13 of 18 
Hi, so I've been trying to get a start with the code Roger posted, but am having trouble summing over the displacement positions over 1000 walks to get an average displacement. Here is the bare structure of what I have; I just can't figure out the right expression to add up the displacements in my second innermost loop. 
Subject: Matlab 3d Walk problem From: Justin Twardowski Date: 21 Nov, 2010 19:54:04 Message: 14 of 18 
bump 
Subject: Matlab 3d Walk problem From: Justin Twardowski Date: 21 Nov, 2010 22:37:03 Message: 15 of 18 
Anyone? I feel like my information is being outputted in the wrong fashion for me to be able to work with and sum over the 1000 repeated walks. 
There are a few ways you might do it but here is one which  I think  does what you want. 
Hi everybody, I am presently working on lattice modelling, where we have to move aparticle in 3D randomly along the sides of a cubic lattice. I want to create a random unit vector along the lattice (6 possible ways of moving the particle). I am little bot confused about it. Can you guys please suggest me a suitable way? 

No tags are associated with this thread.
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.