Brownian Path Simulation - Plotting more than one path

15 ビュー (過去 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 Center および File ExchangeSurfaces, Volumes, and Polygons についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by