Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

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

Step: 3

blur-text-image

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

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions