I am creating a Monte Carlo simulation with 1000 simulations over 252 days (1000x252 matrix). Currently, my code only uses S0 to calculate future prices, but I need to calculate future prices using n-1 price (markov). My current code is:
i=1000;
T=252;
eps=normrnd(0,1,[i,T]);
S0=2809;
K=2750;
for j=2:252;
for c=1:1000
S(c,j)=S0*exp((.0295-.5*(.2^2))*.004+.0295*sqrt(.004)*eps(c,j));
end
end
How can I keep one variable S but referencing S0 for column 1 and S_n-1 for columns 2:252? Is this possible or do I need to create a second variable?