function Two_Portfolio_example()
% copyright by lige and fantuanxiaot
% 两个组合
% portfolio_return用来形成期望收益
% portfolio_std用来形成标准差
return1=0.15;
std1=0.24;
return2=0.12;
std2=0.18;
portfolio_return=zeros(1,50);
portfolio_std=zeros(5,50);
portfolio_corrrelation=-1:0.5:1;
%% 形成不同相关系数下的组合
for i=1:50
w1=0.02*(i-1);
w2=1-w1;
portfolio_return(i)=return1*w1+return2*w2;
for j=1:5
portfolio_std(j,i)=sqrt((std1*w1)^2+(std2*w2)^2+2*std1*w1*std2*w2*portfolio_corrrelation(j));
end
end
portfolio_std1=portfolio_std(1,:);
portfolio_std2=portfolio_std(2,:);
portfolio_std3=portfolio_std(3,:);
portfolio_std4=portfolio_std(4,:);
portfolio_std5=portfolio_std(5,:);