Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

***MATlab coding project! Please help, really unsure what to do! Can you please make it super easy to copy and paste over? Note: Type the

image text in transcribed

***MATlab coding project! Please help, really unsure what to do!

Can you please make it super easy to copy and paste over?

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

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

Select Healthcare Classification Systems And Databases

Authors: Katherine S. Rowell, Ann Cutrell

1st Edition

0615909760, 978-0615909769

More Books

Students also viewed these Databases questions

Question

2. How much time should be allocated to the focus group?

Answered: 1 week ago

Question

1. Where will you recommend that she hold the focus group?

Answered: 1 week ago