Question
Using MATLAB or equivalent program, simulate the trajectories of particles undergoing a one-dimensional random walk based on the equation in class: Xi(n) = Xi(n1) where
Using MATLAB or equivalent program, simulate the trajectories of particles undergoing a one-dimensional random walk based on the equation in class:
Xi(n) = Xi(n1)
where xi(n) represents the position of the ith particle after n steps, which has a 50% probability of moving forward by \delta and a 50% probability of moving backwards by \delta. Let = 12 and simulate M = 100 particles (all starting at x = 0), for 150 timesteps. Plot all 100 particle positions xi(n) from n = 1 to 151 timesteps.
HINT: MATLAB function randi returns random integer values chosen uniformly from between a specified interval. Alternatively, PYTHON function random.randint(a,b) will return a random integer between a specified interval (requires importing the random module)
HINT2: MATLAB programs run faster when vectorized. Note that Xi can be represented as a vector of (M x 1) particle positions, and that randi can output random integer values as a vector of (M x 1) forward or backward steps.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started