Question: Write a MATLAB function called c=reimsum(P,a,b,n) which accepts as inputs a polynomial P and three scalars a, b, and n. And it returns a scalar

Write a MATLAB function called c=reimsum(P,a,b,n) which accepts as inputs a polynomial P and three scalars a, b, and n. And it returns a scalar c. The program will use Riemann sums to approximate the definite integral of the polynomial on the interval [a,b]. The Riemann sum calculation will use n subintervals of the equal length with the value of the function taken at the midpoint of each subinterval. The scalar c (output) gives the Riemann sum approximation of the definite integral.

Type the polynomials given below:

The command x=sym(x) will allow you to do that (see Part II of this project). The program could use for loop, the command sym2poly, and the MATLAB function polyval.

Determine the outputs of your function on the interval [10,10] for the polynomials:

(a) P(x) = 3x4 6x2 8 and (b) P(x) = x5 5x3 + 2x

for n =1, 5,10, 50,100.

For each polynomial give your results in a table which includes entries for n and the outputs c.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!