Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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