Question: MatLab: Programming help is needed Evaluating a polynomial can be an expensive thing for a computer. The cheapest way to evaluate a polynomial is to

MatLab: Programming help is needed

MatLab: Programming help is needed Evaluating a polynomial can be an "expensive"

Evaluating a polynomial can be an "expensive" thing for a computer. The "cheapest" way to evaluate a polynomial is to use a recursive algorithm. For example if p_4(x) = 3-2x+x^2-5x^3+x^4, begin by rewriting it in a modified expanded form as follows: P_4(x) = 3 + x (-2 + x (1 + x (-5 + x))). Then p_4(x) = 3 + xp_3 (x), where p_3(x) = -2 + xp_2(x), P_2(x) = 1 + xp_1(x), and P_1(x) = - 5 + x. To evaluate p_4(2) we calculate as follows: p_1 (2) = -3 rightarrow P_2(2) = 1 + 2p_1(2) = -5 rightarrow P_3(2) = -2 + 2p_2(2) = -12 rightarrow P_4(2) = 3 + 2p_3(2) = -21. Write a recursive Matlab function called recursivepoly .m to calculate the value of any polynomial function given a list of its coefficients (in ascending order) and a value of x. Program specifications and sample function calls are discussed below

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!