Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

What exactly is the difference between quadprog and portopt in Matlab? For example if I use quadprog (minimizing the variance) in a loop in which I continuously iterate through the expected returns of 10 portfolios to calculate the weights of assets, will that be same as calling portopt with the expected returns of assets and portfolios to generate weights (and other stuff) ?

share|cite|improve this question
up vote 0 down vote accepted

You should end up with equivalent portfolios. However, for various reasons, you may not. For example, portopt in Matlab uses a linear programming solver with constraints by default, rather than a quadratic programming solver (though you can force it to use quadprog by setting the algorithm flag, see here).

More importantly, the convergence of quadprog in Matlab is not great, especially for high dimensional problems. I would recommend using a fast and dedicated quadratic programming solver such as Mosek instead.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.