Create covariance matrix : I want to generate 50 covariance matrix for this data set, by letting the date jump on 24 days . I will let the xls file follow with

1 view (last 30 days)
close all; clear all; clc;
data1 = xlsread('dataCompanyprices','Sheet1','W4:AP1203');
data = data1(:,:);
counter = 0;
for i=1:50:length(data1)
counter = counter + 1;
dd(counter,:) = data(i,:);
S = std(dd)*sqrt(252); %Standard deviation for assets
C = cov(dd)*252;
end

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Products

Community Treasure Hunt

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

Start Hunting!