Question: Need help writing this function on MATLAB: it accepts as inputs: a polynomial P, a vector n , and two scalars a , b .
Need help writing this function on MATLAB: it accepts as inputs: a polynomial P, a vector n, and two scalars a, b. The program will use Riemann sums to approximate the definite integral on the interval [a,b] of a given
polynomial P. Riemann sum calculations should be performed using partitions of [a,b] by
subintervals of equal length h defined as h = (b a)/n(j),
where n(j) is a jth entry on n, j=1:N, and N= length(n). Each entry of vector n, n(j), is equal
to the number of subintervals of the corresponding partition of [a,b].
Your function has to return a table T whose first column is the vector n. Columns 2 4 are the column vectors c, d, f of the Riemanns sums approximations of the integral of P on the interval [a, b], with the numbers of subintervals of partition defined by the entries of n, and the value of the function to be chosen at the left endpoints (gives vector c), at the middle points (gives vector d), and at the right endpoints (gives vector f) of each subinterval of the partition.
Should look like this.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
