Simulate 10.000 paths for a 30 year period

조회 수: 3 (최근 30일)
Cecilie Pedersen
Cecilie Pedersen 2016년 10월 4일
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개)

카테고리

Help CenterFile Exchange에서 Language Fundamentals에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by