Brownian Path Simulation - Plotting more than one path
15 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am to create a discrete sample Brownian path. I believe I have the code complete, but if any mistakes, please do not hesitate in letting me know. I am trying to figure out how to generate 100, 1000, 10000 paths with T = 1 and n = 200. I'm not sure where exactly that goes. Thank you.
function [W] = brownianPath (T,n)
%t = 0, T/n, 2T/n, ..., T where T = termination time & n = steps%
stepsize = T/n;
t = 0:stepsize:T;
dW = zeros(1,n);
W = zeros(1,n);
dW(1) = randn/sqrt(stepsize);
W(1) = dW(1); %W(0) = 0 with probability 1%
for m = 2:n
dW(m) = randn/sqrt(stepsize);
W(m) = W(m-1) + dW(m);
end
plot([0:stepsize:T],[0 W], 'g-');
xlabel('t')
ylabel('W(t)')
end
0 comentarios
Respuestas (1)
Abhishek Ballaney
el 7 de Feb. de 2018
Editada: Walter Roberson
el 11 de Feb. de 2018
1 comentario
Natesha Alexander
el 18 de Nov. de 2018
How can I adjust to simulate a scaled Brownian path sqrt(2D)*Wt?
Ver también
Categorías
Más información sobre Surfaces, Volumes, and Polygons en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!