Why do I receive an error with FZERO on a vector-valued function in MATLAB?

1 view (last 30 days)
I am trying to use FZERO on a vector valued function and I receive the following error:
ERROR: ??? Operands to the || and && operators must be convertible to logical scalar
values.
Error in ==> fzero at 449
while fb ~= 0 && a ~= b

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Apr 2023
Edited: MathWorks Support Team on 19 Apr 2023
This is not a bug in MATLAB with the FZERO function, but the expected behavior. Acoording to the documentation, FZERO only accepts handle to a scalar-valued function and finds its root.
One of the ways to find roots of a vector valued function is to pose it as a multi-objective optimization problem. Please refer to the following webpage for more information about minimizing multiple objective functions in MATLAB:

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!