Replicate a density plot?! How To?
Mostra commenti meno recenti
Hey there,
I have read the paper "The Heston Model A Practical Approach von Moodley (2005)". On page 3 there is the following plot of a density. It shows how the density changes, with a change in the parameter rho:

The Code given is the following:
S0 = 10; V0 = .01; r = 0; k = 2;
theta =.01; sigma= .1; delT = .02; rho =-0.9;
numberOfSimulations = 1000000;
i = 1:numberOfSimulations;
NormRand1 = randn(1,numberOfSimulations);
NormRand2 = randn(1,numberOfSimulations);
S = zeros(1,numberOfSimulations);
V = zeros(1,numberOfSimulations);
V(i) = V0 + k*(theta - V0)*delT + sigma*sqrt(V0)* ...
(rho*NormRand1 + sqrt(1- rho^2)*NormRand2)*sqrt(delT);
V = abs(V); %prevents negative volatilities
S(i) = S0 + r*S0*delT + S0*V.^(0.5).*NormRand1*sqrt(delT);
Nothing more is given than this code. But i dont get how to build it, with this code? Maybe someone can help me with it.
kind regards david
Risposta accettata
Più risposte (0)
Categorie
Scopri di più su Graphics Performance in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!