- Joined
- 5/21/09
- Messages
- 13
- Points
- 11
Hi,
I am using Matlab to simulate a pure Wiener process. The initial value is 1, drift is 0, diffusion is 1, 100 timesteps, 1000 paths, from t = 0 to 1. My results is attached with this post.
My graph clearly shows the expected value at T = 1 is 1, so this is good. Theoretical Wiener has variance (1-0=1) at T=1. So the final values should be in [0,2] range, but this is not the case in my graph. Anybody knows why?
x0 = 1;
A = 0;
B = 1;
T = 1;
N = 100
M = 1000;
randn('state', 88); % Initalise the random generator
dt = repmat(T/N, 1, M); % Size of a single time step
x = repmat(x0, N+1, M); % Array to hold the simulation
t = linspace(0, T, N+1); % Array to hold times
for i=1:N
x(i+1,: ) = x(i,: ) + (A * dt) + (B * sqrt(T/N) * randn(1,M));
end
% Draw the distributions
clf reset;
plot(t,x);
I am using Matlab to simulate a pure Wiener process. The initial value is 1, drift is 0, diffusion is 1, 100 timesteps, 1000 paths, from t = 0 to 1. My results is attached with this post.
My graph clearly shows the expected value at T = 1 is 1, so this is good. Theoretical Wiener has variance (1-0=1) at T=1. So the final values should be in [0,2] range, but this is not the case in my graph. Anybody knows why?
x0 = 1;
A = 0;
B = 1;
T = 1;
N = 100
M = 1000;
randn('state', 88); % Initalise the random generator
dt = repmat(T/N, 1, M); % Size of a single time step
x = repmat(x0, N+1, M); % Array to hold the simulation
t = linspace(0, T, N+1); % Array to hold times
for i=1:N
x(i+1,: ) = x(i,: ) + (A * dt) + (B * sqrt(T/N) * randn(1,M));
end
% Draw the distributions
clf reset;
plot(t,x);
