How to create a unit wiener process
18 次查看(过去 30 天)
显示 更早的评论
I want to create a wiener process with mean = 0, and variance 1. I wrote the following script and get mean values close to zero but the variance is much smaller than 1. What can i do?
T = 1; N = 500;
dt = T/N;
dW = zeros(1,N); % preallocate arrays ...
W = zeros(1,N); % for efficiency
dW(1) = sqrt(dt)*randn; % first approximation outside the loop ...
W(1) = dW(1); % since W(0) = 0 is not allowed
for j = 2:N
dW(j) = sqrt(dt)*randn; % general increment
W(j) = W(j-1) + dW(j);
end
1 个评论
Torsten
2017-8-21
How do you calculate "variance" from the piece of code from above ?
Best wishes
Torsten.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!