Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Does anyone know how to use MATLAB to produce this graph?

  1. Dec 24, 2011 #1
    Does anyone know how to use MATLAB to produce this graph??

    I'm writing a mathematical essay on Option Pricing and would like to include a graph which displays a process called a Wiener Process.

    This is basically a process where the change [itex] \Delta z [/itex] in a time interval [itex] \Delta t [/itex] is modelled by

    [itex] \Delta z = \epsilon\sqrt{\Delta t} [/itex]

    where [itex] \epsilon [/itex] is a normal random variable with mean 1 and variance 0.

    So for each [itex] \Delta t [/itex], [itex] \epsilon [/itex] computes one normal random variable. And the true graph is obtained when [itex] \Delta t \to 0 [/itex]. The graph should look something like this

    HullBookF12-1-2.jpg


    Does anyone know what the MATLAB sequence would be to compute this??

    I would really appreciate any help!

    Thank :)
     
  2. jcsd
  3. Dec 27, 2011 #2

    jasonRF

    User Avatar
    Science Advisor
    Gold Member

    Re: Does anyone know how to use MATLAB to produce this graph??

    I am assuming you mean epsilon has mean zero and variance 1, since variance=0 means a constant. Anyway, you can do it something like this

    dt = 0.01; % you pick this to be whatever you want
    N = 1000; %number of points to use = whatever you want
    epsilon = randn(N,1); %Nx1 vector of unit variance, zero mean normally distributed random numbers
    dz = epsilon*sqrt(dt);
    z = cumsum(dz); %sum up the dz
    t = (0:N-1)*dt; %vector of t values
    plot(t,z);

    I think this is what you are looking for. Enjoy.

    jason
     
    Last edited: Dec 27, 2011
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook