Question: ***Matlab coding project, really need help! Note: Type the polynomials in MATLAB workspace as described in Exercise 3 of this project (the command syms x

***Matlab coding project, really need help!
Note: Type the polynomials in MATLAB workspace as described in Exercise 3 of this project (the command syms x will allow you to do that) Difficulty: Moderate Exercise 4 (4 points) In this exercise you will approximate the value of the definite integral of a polynomial using both Riemann sums and a MATLAB built-in function int %write a com ment in your file (by comparing the entries of the table T with 1) which choice of the points Left, Middle, or Right scem to provide a better approximation for the integral The code 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 To help you with the code, here is an example of an output corresponding for the polynomial P( x)2x, on the interval [-5,5) for n [1:5]. -5ib-5 n-11:5) n E h- (b- a) n), where n(j) is a jth entry on n, j-1:N, and N-length(n). Each entry of vector n n), 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 Riemann's 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 ayma x Fsx" 3-2-? x3-2*x T I1-reinsum (P,a,b,n) Left Middle Right -1150 -575 -383.333333333333 -287.5 -230 1150 575 383.333333333333 287.5 230 Write a MATLAB function IT, Ireimsum(P,a.b.n) that calculates vectors e, d, fas described above and forms a matrix A n, c,d', f']. The following command converts the 4-by-N array A into a 4-by-N table T with the names of the variables as indicated bclow: Note: You noticed that when you capture the command window output using the diary function, the table headings are enclosed in
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
