Optimization problem with constraints
Show older comments
Hi all. Supposing I've a matrix A(n,m) of daily returns where 'n' are daily observations and 'm' are number of assets and that SR(1,m) is a vector of Sharpe Ratios, calculated on the above matrix. My target is to find the optimal weights w(1,m) which maximize sum(SR.*w,2) given the constraints that the weigths sum up to 1 (sum(w,2)=1) and that all weights are >=0. It's pretty simple in Excel with the Solver tool but i'm not so familiar with the optimization functions in Matlab. Thank you very much in advance for your kind support. Regards
Answers (1)
Alan Weiss
on 22 Sep 2015
0 votes
I am not familiar with the financial model you discuss. However, it is likely that fmincon can do what you want. If you have Optimization Toolbox, just follow the steps to shoehorn your problem into the syntax it expects. See the Getting Started example.
In particular, the constraint that the weights add up to 1 and are nonnegative are easily handled by a linear equality constraint and bounds respectively.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Categories
Find more on Get Started with Optimization Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!