%% Represent Market Models Using SDEDDO Models
%% Load the Data Set

load Data_GlobalIdx2
prices  = [Dataset.TSX Dataset.CAC Dataset.DAX ...
Dataset.NIK Dataset.FTSE Dataset.SP];

%
%% Convert daily prices to returns

returns =  tick2ret(prices);

%
%% Compute statistics for the simulation

nVariables  = size(returns, 2);
expReturn   = mean(returns);
sigma       = std(returns);
correlation = corrcoef(returns);

%
%% Specify drift and diffusion functions

F = drift(zeros(nVariables,1), diag(expReturn))
G = diffusion(ones(nVariables,1), diag(sigma))

%
%% Specify the SDEDDO Model Using the Drift and Diffusion Functions

SDEDDO = sdeddo(F, G, 'Correlation', correlation, ...
'StartState', 100)

% Copyright 2015 The MathWorks, Inc.