2
$\begingroup$

I'm trying to explain the fact that a Brownian motion has independent increments by highlighting disjoint segments of a sample path of a Brownian motion. So, given a sample path of a (standard) Brownian motion

ListLinePlot[RandomFunction[WienerProcess[], {0, 1, 0.01}]]

how does one color the trajectory (for example) from 0.1 to 0.3 red, and from 0.5 to 0.8 blue?

$\endgroup$
1

1 Answer 1

6
$\begingroup$
ListLinePlot[RandomFunction[WienerProcess[], {0, 1, 0.01}],
     Mesh -> {{0.1,0.3,0.5,0.8}}, 
     MeshFunctions -> {#1 &},
     MeshShading -> {Black,Red, Black,Blue}]

enter image description here

$\endgroup$
1
  • $\begingroup$ This is exactly what I was looking for. Thanks very much! $\endgroup$
    – Peter
    Commented Jun 29, 2017 at 17:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.