clear; clc; close all;

s = 260;
r = 0.1;
v = 0.3;
N = 252;
dt = 1 / N;
M = 1000;

figure; hold on; grid on;
prices_last_day = zeros(1, M);
for j = 1 : M    
%     S = zeros(1, 1 + N);
%     S(1) = s;
%     for i = 2 : N + 1
%         S(i) = S(i - 1) * (1 + r * dt + v * sqrt(dt) * randn(1));
%     end
    ds = (1 + r * dt + v * sqrt(dt) * randn(1, N));
    S = s * cumprod([1, ds]);
    plot(S);
    prices_last_day(j) = S(end);
end
figure;
histogram(prices_last_day, 'normalization', 'probability');
grid on;



