MATLAB: Fzero, Operands to the || and && operators must be convertible to logical scalar values.

fzerointegral

My code is:
integral(@(x) fzero(@(y) y-x-1,[0,20]),1,10)
Here is the error I get:
Operands to the || and && operators must be convertible to logical scalar values.
Error in fzero (line 444)
while fb ~= 0 && a ~= b
My fzero function is complicited. So I just use the simple fzero function of y-x-1 to replace my function.
Any help is appreciated, thanks!

Best Answer

integral(@(x) fzero(@(y) y-x-1,[0,20]),1,10, 'arrayvalued', true)