Question: Please help me with this matlab problem. Thank you. Problem 1: Construction of functions (numerical solvers) for numerical computations The trapezoidal or midpoint rule is

Please help me with this matlab problem. Thank you.

Please help me with this matlab problem. Thank you. Problem 1: Construction

Problem 1: Construction of functions (numerical solvers) for numerical computations The trapezoidal or midpoint rule is often used to approximate the integral of a given function since it is the average of the left and right Riemann sums and generally provides a more accurate solution. The algorithm for the trapezoidal rule is given as follows: [f(x) + f(xk+1)] a) Based on what is learned in class about the left-Riemann sum and right-Riemann sum algorithms, create a user-defined MATLAB function that performs numerical integration using the trapezoidal rule. The numerical solver should have the following input/output structure: function I = trapf(fun, a, b,N) b) Using the trapf function created in part (a), evaluate the integral of the curve f(x) = -2x3 + 6x2 + 3 over the interval [0,3] using 10 subintervals. Calculate the percent error by using the results from the built-in function integral. c) Repeat part (b) with 5 subintervals and 20 subintervals. What can you conclude about the correlation between the number of subintervals and the relative percent error

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!