clc
clc;
clear all;
close all;

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Two assets : Expected return (R_bar)
c =[1.1 1.2]

%% the variance-covariance matrix (V)
cov = -1*0.1*0.25
var_Ra = 0.1^2
var_Rb = 0.25^2
V = [var_Ra cov; cov var_Rb]
V =[0.1^2 -0.025;-0.025 0.25^2]

V_inv = inv(V)
e =ones(size(c))

alpha =e*V_inv*transpose(c) 
sigma =c*V_inv*transpose(c)
delta =e*V_inv*transpose(e)

R_bar =alpha/delta
variance =1/delta
std =sqrt(variance)

%% Question 1
%% the optimal weight for the minimum-variance portfolio
w = variance*V_inv*transpose(e)

%% Question 2
%% the expected return of the the minimum-variance portfolio
R_mv =alpha/delta

%% the variance of the the minimum-variance portfolio
var_mv =1/delta