Simulate 10.000 paths for a 30 year period
3 views (last 30 days)
Show older comments
I want to look at/simulate how financial wealth evolves over a 30 year period, using the fact that the financial wealth follows a stochastic brownian motion process and using 10.000 different simulated paths.
A code that does something similar is
T = 1; N = 100; dt = T/N;
t = 0:dt:T;
%
% M = number of sample paths
M=1000;
%
% generate Gaussian increments
%
dW = sqrt(dt)*randn(M,N);
%
S0 = 42; r=0.1; sigma = 0.2; mu = r - (sigma^2)/2;
%
% generate M x N matrix of M sample paths and plot them
%
S = S0*exp(mu*ones(M,1)*t + sigma*[zeros(M,1), cumsum(dW,2)]);
plot(t,S)
And it is something like this i want to do, just with dt = 1 year and for 30 years. Can you maybe help or tell how/where I can find appropriate codes for this issue.
The dynamics are given as


where Pi is the weight of risky assets. In the outset this is just running from 90 % to 50 %
I really hope to hear from you
0 Comments
Answers (0)
See Also
Categories
Find more on Language Fundamentals in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!