Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write in Matlab Problem 3 : Polynomial evaluation by nested form & by formula The purpose of this exercise is to practice with creating
Please write in Matlab
Problem 3 : Polynomial evaluation by nested form & by formula The purpose of this exercise is to practice with creating for loops, applying nested multiplication, and defining function.m files. Create a function in a separate .m file with the following definition: function [p] = nestedPoly(x, coeff) that returns the value of the polynomial with coefficients coeff on x using nested multiplication. The coefficients should be assumed to be stored from higher to lower order. You may use the function posted on Canvas. In your prob3(), 1 (a) Call your function to evaluate the polynomial P(x) = x30 + x29 + x28 + ... + x2 + x + 1 at x You may find the function ones useful for creating the vector of coefficients of P. (b) Notice that the sum you calculate on the previous step is a sum of a geometric sequence with ratio x. Therefore, another way to evaluate P(x) on any point x, x + 1, is to use the formula P(x) X31 - 1 X-1 Use this formula to evaluate P and compare to the result you got using your nestedPoly function, using the absolute error. Write your observations in a block of comments. PC)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started