You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

a)

closingPrices = [100 101 102 100 102 104 103 98 96 101];

b)

plot(1:10, closingPrices);

c)

function dailyReturn = dailyReturns ( closingPrices )
    n = size(closingPrices , 2);
    dailyReturn = zeros(n, 1);
    for i = 2:n
        dailyReturn(i)= closingPrices(i)-closingPrices(i-1);
    end
end
  • No labels