Quiz:
(1). Brownian motions: Simulate graphs of one dimensional Brownian motions, and trajectories/paths of two or three dimensional ones.
(2). Itô processes or solutions of stochastic differential equations: Simulate geometric Brownian motions, Vasicek models, and Cox-Ingersoll-Ross models.
(3). Black-Scholes-Merton model: Compute the exact value of option given by the BlackScholes-Merton formula. Perform simulations for the stock price equation under the risk-neutral probability measure. Then compute the corresponding expectation/mean/average of the discounted option payoff at the expiration time to obtain numerical solutions, i.e., approximate values of option. As the number of simulations increase, demonstrate the convergence of the numerical solutions to the exact value.
知识1process🐕
Q1代码实现
% Brownian motion in MATLAB
T=1
N=100
t=T/N
Z0=0
Z=zeros(1,N)
Z(1)=randn*sqrt(t)
for j=2:N
Z(j)=Z(j-1)+randn*sqrt(t)
end
plot((0:t:T),[Z0,Z])
ylabel('w(t)')
xlabel('t')
完整代码(MATLAB)需要分开运行,便于展示放在一个f 文件。
t0=1
tf=11
dt=0.1
[t,w]= BM1(t0,tf,dt)
plot(t,w);
xlabel('t');ylabel('w')
title('1-dimensional B-M')
x0=0;xf=10;dt=0.1;
y0=0;yf=10
z0=0;zf=10<