How to use fsolve with constraints?

4 views (last 30 days)
Alexandre
Alexandre on 14 Jan 2014
Commented: Alexandre on 15 Jan 2014
Hi,
I am using fsolve to compute the portfolio weights of some assets.
I would like fsolve to calculate these weights with a short-selling constraint, so that any asset weight could be less than 0.
How can I do this?
Thank you very much.

Accepted Answer

Matt J
Matt J on 14 Jan 2014
Edited: Matt J on 14 Jan 2014
LSQNONLIN is more or less a version of FSOLVE which supports upper and lower bound constraints. For more complicated constraints, you would need FMINCON, most likely.
It sounds like your problem actually has no constraints if the asset weights can be both positive and negative.
  1 Comment
Alexandre
Alexandre on 15 Jan 2014
Hi Matt,
I had to use FMINCON (as described in http://www.mathworks.fr/fr/help/optim/ug/nonlinear-systems-with-constraints.html). So, the equation I wanted to solve was set as an FMINCON constraint. For some reason LSQNONLIN didn't work well for me.
Thank you.

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!