% evaluate a polynomial and its error bound % function [val,errorbound] = polyvalbnd(coef,x) % Inputs: % coef = array of polynomial coefficients, starting with highest order % x = (array of) argument % Outputs: % val = value of polynomial = polyval(coef,x) % errorbound = bound on roundoff error in polynomial evaluation % = 2*degree*macheps*polyval(abs(coeff),abs(x)) function [val,errorbound] = polyvalbnd(coef,x) val = polyval(coef,x); errorbound = .5*eps*polyval(abs(coef),abs(x));