Why does the "fsolve" function in Optimization Toolbox not converge when using a quadratic cost function?
4 views (last 30 days)
Show older comments
MathWorks Support Team
on 1 Sep 2023
I am using the "fsolve" function to optimize a vector of complex coefficients using a quadratic cost function.
I am able to obtain accurate results if I use a linear cost function. However, when I use the quadratic cost function, the solver does not converge. Why does using linear cost converge but using quadratic cost does not converge?
Accepted Answer
MathWorks Support Team
on 1 Sep 2023
The algorithm in "fsolve" already solves for the quadratic form that you want. See the Algorithm notes in the following documentation page:
The following reference page explains more about the algorithm "fsolve" uses:
If you would still like to solve using a quadratic cost function, you could use the "quadprog" function.
Another reason that problems do not converge could be scaling. If the initial point is very large when squaring the objective function, this value is also squared. Thus, the solver starts from a much "worse" point.
One possible remedy could be to scale the problem so that the objective values are in a more reasonable range. You might find the "center and scale your problem" section in this documentation page helpful:
0 Comments
More Answers (1)
Matt J
on 26 Sep 2023
Very often, quadratic functions have no roots to find, e.g.,
fsolve(@(x) abs(x).^2+1, [1+1i;0+3i])
0 Comments
See Also
Categories
Find more on Nonlinear Optimization 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!