Geometric Brownian Motion (GBM)
13 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Martina Della Monica
am 11 Aug. 2019
Beantwortet: Samatha Aleti
am 14 Aug. 2019
Dear all,
I wrote this code to simulate stock price scenarios by using Geometric Brownian Motion for each business day in one year.
S_0=55.8; % initial price
drift= (mu_oil-sigma_daily_oil^2/2); % drift
npaths= 3000 ; % number of simulations
nsteps=252;
dt=1/252; % time sequence (ti-ti+1)
epsilon=randn(nsteps,npaths);
Weiner= [zeros(1,npaths); cumsum(epsilon).*sqrt(dt)] ;
S_t= bsxfun(@plus, drift*dt, sigma_daily_oil*Weiner);
S_t=S_0*exp(S_t) ;
I would like to compute stock price scenarios only for grid points 1Y 2Y 3Y 4Y 5Y . Is correct to consider dt=1 and nsteps=5? Does anyone can help me , please?
Thank you
Martina
0 Kommentare
Akzeptierte Antwort
Samatha Aleti
am 14 Aug. 2019
Hi,
There is MATLAB class “gbm” to create Geometric Brownian Motion object. There are functions like simulate, simByEuler, simBySolution that can be used with gbm object for simulation. Here is the link for the documentation for further details:
Also, you may set the parameters to get your desired behaviour as follows:
dt=1;
nPeriods = 5;
T = nPeriods * dt;
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Stochastic Differential Equation (SDE) Models finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!