Brownian Path Simulation - Plotting more than one path

조회 수: 13 (최근 30일)
Mel Hernandez
Mel Hernandez 2018년 2월 6일
댓글: Natesha Alexander 2018년 11월 18일
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

답변 (1개)

Abhishek Ballaney
Abhishek Ballaney 2018년 2월 7일
편집: Walter Roberson 2018년 2월 11일
  댓글 수: 1
Natesha Alexander
Natesha Alexander 2018년 11월 18일
How can I adjust to simulate a scaled Brownian path sqrt(2D)*Wt?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Surfaces, Volumes, and Polygons에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by