Professional Documents
Culture Documents
Import Data
Calculate Markowitz Inputs
Calculate the Efficient Frontier
Calculate the Optimal Portfolios
A. Optimal Risky Portfolio
B. Optimal Complete Portfolio
5. Incorporate Constraints
Note: To use the code shown in this presentation, you
must have the Financial Toolbox add-on for Matlab
2
Starting Matlab
Make sure
this points to
the directory
that contains
your data
Youll enter
commands at
the >> prompt
By default, the portopt function imposes a nonnegativity constraint on the asset weights
>> scatter(stdev, m)
hold on
plot(PortRisk,PortReturn,'DisplayName','PortReturn vs.
PortRisk','XDataSource','PortRisk','YDataSource','PortRetu
rn');figure(gcf)
xlabel('Risk (Standard Deviation)')
ylabel('Expected Return')
title('Mean-Variance-Efficient Frontier')
grid on
11
0.025
Efficient Frontier
Expected Return
0.02
0.015
Individual Assets
0.01
0.005
0.02
0.04
0.1
0.08
0.06
Risk (Standard Deviation)
0.12
0.14
0.16
12
0.025
0.02
Expected Return
Optimal
Complete
Portfolio
for A = 5
0.01
0.005
0.02
0.04
0.1
0.08
0.06
Risk (Standard Deviation)
0.12
0.14
14
Optimal
Complete
Portfolio
for A = 2
0.03
0.025
Expected Return
0.02
Optimal Overall Portfolio
Optimal Risky Portfolio
0.015
0.01
0.005
0.02
0.04
0.06
0.08
0.1
Risk (Standard Deviation)
0.12
0.14
15
>>xlswrite('OptimalWeights.xlsx',RiskyWts)
16
The first row contains the lower bound, the second row
contains the upper bound
18
0.04
0.04
0.035
0.035
0.03
0.03
Expected Return
Expected Return
0.025
0.02
Optimal Overall Portfolio
Optimal Risky Portfolio
0.015
0.025
0.02
0.015
0.01
.01
0.005
0.005
0.02
0.04
0.06
0.08
0.1
Risk (Standard Deviation)
No Short Sales
0.12
0.14
0.16
0.02
0.04
0.06
0.08
0.1
Risk (Standard Deviation)
0.12
0.14
0.16
Concluding Remarks