Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Design Using Entity Relationship Diagrams

Authors: Sikha Saha Bagui, Richard Walsh Earp

3rd Edition

103201718X, 978-1032017181

More Books

Students also viewed these Databases questions