File Exchange

image thumbnail

Plot Some Paths

version 1.8 (9.26 KB) by

This application allows you to generate and visualize some random paths



View License

- Plot arithmetic and geometric Brownian motions
- Plot Brownian bridges, 2D and 3D Brownian motions
- Plot some random paths for the the interest spot rate:
The two models you can chose from are the Vasicek and the Cox- Ingersoll-Ross (CIR) models

Comments and Ratings (6)


Stefan (view profile)

Rafael Curiel

This code is good
thank you

Thanks Hairi,

It would indeed be a good idea to make it more flexible, I just haven't gotten around to doing this.
Could you kindly describe what your functions "sedddo"and "simByEuler" do ?



Hairui (view profile)

Your project is very impressive. I really love the idea of combining GUI and m-code to visualize the stochastic processes.

Meanwhile, I think the SDE class in Matlab might be useful if you want to make your project more flexible. I don't know whether this can help, but here's my code of generating random paths using Vasicek:

ntrials = 200;
Steps = 1000;
kappa = 2;
theta = 1;
sigma = 0.4;
X0 = 1;
s = sdeddo(drift(kappa, theta), diffusion(0, sigma), 'StartTime', 0, 'StartState', X0);
p = s.simByEuler(Steps, 'DeltaTime', 1e-4, 'NTRIALS', ntrials);
plot(reshape(p, [Steps + 1, ntrials]));

Kind regards,


This code is extremely helpful to visualize four of most important stochastic models in quantitative finance. I strong recommend this to any one who wants to enter this field.





Brownian motions added


I corrected a typo. CIR stands for Cox- Ingersoll-Ross, I previously entered CID


I corrected a typo. This CIR stands for Cox-
Ingersoll-Ross, I previously entered CID

MATLAB Release
MATLAB 7.5 (R2007b)

Inspired by: Kernel Smoothing Regression

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Win prizes and improve your MATLAB skills

Play today