Error inside of function using feval on user-provided polynomial

Hi all, I am having an issue with my code and I can't figure it out for the life of me. Here's my code:
function [l,r,nf] = bisect(fname,a,b,tol)
if(a == b)
if(feval(fname,a) == 0)
l = a;
r = l;
nf = 0;
return;
else
l = NaN;
r = l;
nf = -1;
return;
end
end
The error message states:
Error using feval
Function to evaluate must be represented as a string scalar, character vector, or function_handle object.
Error in bisect (line 26)
if(feval(fname,a) == 0).
Can anyone point me in the right direction? Help would be so much appreciated.

2 comentarios

What are you passing to bisect()?
Can you specify what input arguments are passed to that function with syntax ?

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Productos

Etiquetas

Preguntada:

el 13 de Oct. de 2019

Comentada:

el 18 de Mzo. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by