Question: Use MATLAB to write a function subroutine horner_yourlastname(a, x0, d) that uses Horners algorithm to evaluate a polynomial at a given point x0. This code
Use MATLAB to write a function subroutine horner_yourlastname(a, x0, d) that uses Horners algorithm to evaluate a polynomial at a given point x0.
This code should have three inputs in the order specified above:
a: a vector of coefficients of the polynomial of interest. The first element of the vector should be the leading coefficient, and the last element should be the trailing coefficient. i. e. The polynomial p(x) = anx n + an1x n1 . . . a1x + a0 should have associated vector a = [an, an1, . . . , a1, a0].
x0: the point at which the polynomial is to be evaluated.
d {0, 1}: a toggle that allows the function to be evaluated at the point if d = 0 or its derivative to be evaluated at the point if d = 1.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
