Question: Write a MATLAB function that evaluates a polynomial function /(x) = ax + an-1*N-1 + ...Q* + ou of order N for a scalar value

 Write a MATLAB function that evaluates a polynomial function /(x) =

Write a MATLAB function that evaluates a polynomial function /(x) = ax + an-1*N-1 + ...Q* + ou of order N for a scalar value x. The function should take a 1 by N+1 array (index 1 to N+1 to be N+1 terms) containing the polynomial coefficients and a scalar value x, and should return the polynomial function value f(x). The coefficient an for the highest power of x the first element of the coefficient array and the coefficient do is the last element of the coefficient array. A sample polynomial function f(x) = 3.5x +1.5 and value x = 1.0 would look like: a = [3.5, 1.5]; x = 1.0; then implement your function Use a loop (while or for) to calculate the result. Think about how will you implement it using element- by-element operation yourself, do not implement it here. Do not use sum in calculating your result. The input of your function is a and x, that will define the polynomial function. The output of your function is y. function y = myFunction(a, x) Test the function for the following cases on your own MATLAB installation. . f(x) = 3.5x + 1.5 for x = 0 . f(x) = 3.5x+1.5 for x = 3 . f(x) = x - 2.5x + 0.7 for x = 0 ./(x) = x2 - 2.5x +0.7 for x = -2

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!