How to program an excel Solver in Matlab
조회 수: 5 (최근 30일)
이전 댓글 표시
I have a problem on an Excel Worksheet and I solve it using the Solver. I'd like to solve the same problem in Matlab but I have tried some Matlab functions and I can't find a good solution.
I explain below the approach of my problem to see if someone can help me. Thank you very much in advance.
I have a liability and I want to cover it with a portfolio of assets. I already have some assets bought (Assets) but I want to complete this portfolio with assets that give me maximum rentability (Additional Assets). In addition, a set of constraints must be satisfied:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/169070/image.gif)
I attach the excel so you can see the vectors K1 and K2. Suppose we have a universe of assets with 3 bonds, Bond1, Bond2 and Bond3 (in the attached file you can see the prices and cashflows of these bonds). The problem we want to solve is to find a solution that maximizes the rentability of the assets by satisfying the constraints described above.
The excel solver finds the following solution:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/169071/image.gif)
This solution satisfies all restrictions and obtains a return of 2.97%.
In Matlab I have tried the fmincon function but the solution it finds is worse than the excel or it does not satisfy all the restrictions. Anyone know how I can implement this problem in matlab?
Thanks in advance.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Linear Least Squares에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!