Routines for simulating paths of stochastic processes: random walk, Poisson process, Brownian motion and their multidimensional versions, as well as birth-and-death processes, branching and reproduction models. See
2002; birthdeath.m, bm3plot.m, brownian.m, galtonwatson.m, moran.m, poisson2d.m, poisson3d.m, poissonjp.m, poissonti.m, ranwalk2d.m, ranwalk3d.m, ranwalk.m, README, rw3plot.m
comment: Intuitive, but not the most efficient way of programming.
a 2-Dimensional Random Walk process program in matlab.
comment: A couple remarks for this homework solution:
– several (most!) variables are never used (T,s,t, mx,my,mr)
– explain what the input variable n is in the help, because not « any value of time n » is valid. (it can be a positive integer only!)
– add an error check for that in the code
– The help can be improved. Explain what the user may expect (a plot!).
– why not return both X and Y?
– Have you actually typed « help two_D_Rand_walk »? What you get is not very informative for the user, isn’t it? Or do you want a lot of emails😉
Monte Carlo (PDF)
Matlab Tutorial (PDF)
Replicate a certain number of starting copies of DNA for several cycles. Try different probabilities of replication to get different histograms showing how much DNA is produced over many trials.
Put this in the same directory as pcr_sim.m to be able to run « pcr_sim » from the matlab prompt.
Random Walk – 2D with 2 Particles (M)
Look at how these simulations work and try making your own 3D random walk or have your particle trace out a trajectory in Matlab.
Random Walk – 2D (M)
———-tutorial of Matlab (first approach for dummies) , exemple walk 1D: