You defined the nested poly() function with this signature
function polynomial = poly(ii);
But then you are calling it like this
Also, the task only requires you not to use for-loop. It does not say to do it with recursion. Following is a more intuitive loop-free approach.
function fh = get_polynomial_handle(p)
function polynomial = poly(x)
polynomial = sum(p.*x.^(0:numel(p)-1));
end
fh = @poly;
end
Best Answer