function [t,s1,s2,u1,u2,sig1e,sig2e,rhoe] = computeRho(rho,sig1,sig2)

% Computes volatilities and correlation from stock data
%
% [t,s1,s2,sig1,sig2,rho] = computeRho(rho,sig1,sig2)

n = 10*252; dt = 1/252; % 3 years of fabricated data

s1 = zeros(1,n+1); s2 = zeros(1,n+1);

rhoc = sqrt(1-rho^2);

s1(1) = 10; s2(1) = 15;
t(1) = 0;

for j=1:n
	r1 = randn*sqrt(dt); r2 = randn*sqrt(dt);
        t(j+1) = t(j) + dt;

        s1(j+1) = s1(j)*exp(sig1*r1);
        s2(j+1) = s2(j)*exp(sig2*rho*r1+sig2*rhoc*r2);
end

u1 = zeros(1,n); u2 = zeros(1,n);

for k=1:n-1
    u1(k) = log(s1(k+1)/s1(k)); u2(k) = log(s2(k+1)/s2(k));
end
   
sig1e = sqrt(var(u1))/sqrt(dt); sig2e = sqrt(var(u2))/sqrt(dt);
    
rhoe = corr(u1,u2);

end
