Efficient frontier in Matlab
3 views (last 30 days)
Show older comments
I'm trying to define the efficient frontier and the efficient portfolio using these lines of code:
%Variance,Covariance matrix and expected return matrix are defined bellow.
%The investment universe contains 4 assets
for r = 0.01:0.002:0.2;
P = [0.0845 0.0466 0.0711 0.0834
0.0466 0.1190 0.0530 0.1140
0.0711 0.0530 0.1410 0.0930
0.0834 0.1140 0.0930 0.1723];
PI = inv(P);
R = [ 0.0725 0.1005 0.1240 0.1425];
RT = R';
UN = ones(4,1);
UNT = UN';
A = R*PI*UN;
B = R*PI*RT;
C = UNT*PI*UN;
L = (C*r-A)/(B*C-A^2);
%Lamda
U = (B-A*r)/(B*C-A^2);
%Mu
X = [PI*((L*RT)+(U*UN))]
%X is giving the asset allocation for each iteration
VarOptimum = L*r + U
end
Now how do I find the mimumum variance asset allocation and how do I "draw" the efficient frontier graph.
Thanks
0 Comments
Answers (0)
See Also
Categories
Find more on Portfolio Optimization and Asset Allocation in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!