How use constrained nonlinear optimization when want function to equal zero rather than be minimized?

1 view (last 30 days)
I need to regress parameters for a cubic polynomial where all roots need to be real, and I need to specify which real root is the answer in each case; there may be 30 data points, and one point needs to have all three roots have the same value, 10 points require that the first root be the answer, 10 require the second root to be the answer, and the rest require that the third root be the answer. I think that nonlcon allows me to enforce which roots are the answer for each case, but I don't see which solver to use. fgoalattain doesn't set F(x) equal to the goal, but only =< goal. And fmincon minimizes the function, but it doesn't set it equal to zero. Is there a nonlinear optimizer that allows you to set the objective function equal to zero and use nonlinear constraints? nlinfit allows the objective function to be zero, but doesn't permit constraints.
Thank you, Todd

Answers (1)

August Brandberg
August Brandberg on 2 Jul 2019
To get the exact root, a symbolic equation solver is needed, rather than a numerical one.
I would look for the analytical solution, if such a solution exists.

Products

Community Treasure Hunt

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

Start Hunting!