%% Use simByTransition with heston Object
% Simulate Heston sample paths with transition density.
% Define the parameters for the heston object.

Return = 0.03;
Level = 0.05;
Speed = 1.0;
Volatility = 0.2;

AssetPrice = 80;
V0 = 0.04;
Rho = -0.7;
StartState = [AssetPrice;V0];
Correlation = [1 Rho;Rho 1];

% Create a heston object.

hestonObj = heston(Return,Speed,Level,Volatility,'startstate',StartState,'correlation',Correlation)

% Define the simulation parameters.

nPeriods = 5;   % Simulate sample paths over the next five years
Paths = simByTransition(hestonObj,nPeriods);
Paths

% Copyright 2020 The MathWorks, Inc.