## Thursday, July 31, 2008

### matlab .m; random walk

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

http://www.math.uu.se/research/telecom/software/

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.

Ref.

----------------

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 ;-)

Ref.

----------

http://ocw.mit.edu/OcwWeb/Biological-Engineering/20-011JSpring-2004/Simulations/

# Simulations

MATLAB® software is required to run the .m and .fig files in this section.Resources

Monte Carlo (PDF)

Matlab Tutorial (PDF)

PCR simulator

pcr_sim.m (M)
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.

pcr_sim.fig (FIG)
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.

Lab

Random Walk - 2D (M)

----------

----------tutorial of Matlab (first approach for dummies) , exemple walk 1D:

web.mit.edu/14.451/www/Matlab_Tutorial.pdf

---------