Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Complete the function using Matlab n this exercise, you will write a code which

ID: 3598481 • Letter: C

Question

Complete the function using Matlab

n this exercise, you will write a code which can numerically approximate the integral of the function fx) Func over the interval [a,b] using a middle Riemann Sum with N steps, d using MATLAB's integral function. The code should also output the error between the two calculated areas Function Inputs: Func - the function to be numerically integrated. the lower interval value the upper interval value -the number of rectangles to be used. Function Outputs: Riemann - the numerical approximation for the area under the curve using a middle Riemann sum. integral -the numerical approximation for the area under the curve using the integral function. rror the error between the two area calculations (take the absolute value to ensure this is always positive) ess: Step 1: Solve Area_Riemann -consult your answer from Q3 of last week's exercises tep 2: Solve Area_integral-consult your answer from Q1 of last week's exercises tep 3: Solve Error- this should be the absolute value of the difference between the two areas. Useful Functions: linspace, sum, abs unction Template: function [Area_Riemann, Area integral,Error]-area(Func, a,b,N) %INSERT CODE end

Explanation / Answer

t = 0:pi/10:2*pi; [X,Y,Z] = cylinder(4*cos(t)); subplot(2,2,1); mesh(X); title('X'); subplot(2,2,2); mesh(Y); title('Y'); subplot(2,2,3); mesh(Z); title('Z'); subplot(2,2,4); mesh(X,Y,Z); title('X,Y,Z');