%% Use simBySolution with merton Object
% Simulate the approximate solution of diagonal-drift Merton process.
% Create a merton object.

AssetPrice = 80;
            Return = 0.03;
            Sigma = 0.16;
            JumpMean = 0.02;
            JumpVol = 0.08;
            JumpFreq = 2;
            
            mertonObj = merton(Return,Sigma,JumpFreq,JumpMean,JumpVol,...
                'startstat',AssetPrice)

% Use simBySolution to simulate NTrials sample paths of NVARS correlated state variables driven by NBrowns Brownian motion sources of risk and NJumps compound Poisson processes representing the arrivals of important events over NPeriods consecutive observation periods. The function approximates continuous-time Merton jump diffusion process by an approximation of the closed-form solution.

nPeriods = 100;
[Paths,Times,Z,N] = simBySolution(mertonObj, nPeriods,'nTrials', 3)

% Copyright 2019 The MathWorks, Inc.