Implementing Markowitz Portfolio Optimization in Matlab
조회 수: 16 (최근 30일)
이전 댓글 표시
Hi people,
I'm new to Matlab and I'm trying to implement the following Markowitz portfolio optimization problem in Matlab:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/162557/image.png)
As this is a quadratic optimisation problem I figured I should use the Optimization Toolbox's quadprog() function. I'm having trouble formulating the objective function however and I can't entirely picture how many rows and especially columns it should have. Any help would be much appreciated!
Thanks, Tom
댓글 수: 0
답변 (2개)
Varun Gunda
2017년 4월 6일
As given in the example in the following link:
H would be a nxn matrix, f - nx1 matrix and A- 1xn matrix and b 1x1 matrix.
댓글 수: 0
Aurele Turnes
2017년 5월 18일
편집: Aurele Turnes
2017년 5월 18일
obj = (x' * H * x)/2 + f' * x
You need to build the matrices H and f to pass your objective to quadprog.
To see how to do this, expand the matrix multiplications above (using pseudo-math notation below):
obj = sum_(i=1^n) sum_(j=1^n) H_(i,j)/2 * x_i * x_j + \sum_(i=1^n) f_i * x_i
Identifying the coefficient in front of each unknown term with your equation, you can easily see that:
H_(i,i) = 2* \lambda \sigma_i^2, for i = 1..n
H_(i,j) = 2* \lambda \sigma_(i,j) for i,j = 1..n, i \neq j
f_i = -(1-\lambda) * \bar{r}_i
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Portfolio Optimization and Asset Allocation에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!