# Are quadprog and portopt equivalent in Matlab?

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) ?

-

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.