I have been doing some work with polynomials recently evaluating them in basic form which I think may be inefficient and numerically unstable. I came across Horner’s algorithm which I believe is a superior method to what I am currently doing. I was going to code it myself, but I thought I would ask here first if Matlab has any inbuilt function to do this?
I have been doing some work with polynomials recently evaluating them in basic form
Share
Matlab uses Horner’s algorithm to evaluate polynomials in POLYVAL (the algorithm is implemented as a digital filter for reasons speed in case the polynomial is evaluated for scalar input, see this Mathworks blog post – thanks, Ramashalanka!).
The polynomial 4x^3+3 is represented as
[4 0 3], and can be evaluated for a value (or an array of values) of x like so: