Why does the "fsolve" function in Optimization Toolbox not converge when using a quadratic cost function?

4 views (last 30 days)
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
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:

More Answers (1)

Matt J
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])
No solution found. fsolve stopped because the problem appears regular as measured by the gradient, but the vector of function values is not near zero as measured by the value of the function tolerance.
ans =
0.0000 + 1.0000i -0.0000 + 3.0000i

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!