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 Comments

Can you specify what input arguments are passed to that function with syntax ?

Sign in to comment.

Answers (0)

Products

Asked:

on 13 Oct 2019

Community Treasure Hunt

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

Start Hunting!