Question: Please solve using Matlab The purpose of this exercise is to practice with creating for loops, applying nested multiplication, and defining function .m files (a)
Please solve using Matlab
The purpose of this exercise is to practice with creating for loops, applying nested multiplication, and defining function .m files (a) 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 as presented in class 50 (b) Call your function to evaluate the polynomial Px)-xS0+*4" +*8 +...+x*+x+1- Xx* at x 2. You may find the function ones useful for creating the vector of coefficients of P. (c) 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 0, x 1, is to use the formula x51-1 P(x) =-x-1 Use this formula to evaluate P(2) and compare to the result you got using your nestedPoly function. Are they the same? Write your answer as a comment
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
