Question: In this exercise, you will write a code which can will continue to double the number of steps in a middle Riemann sum while the
In this exercise, you will write a code which can will continue to double the number of steps in a middle Riemann sum while the error between the Riemann sum and MATLAB's integral function is greater than 0.01. The output will be the final Riemann sum that was computed.

Complete the function using Matlab
unction Inputs: unc- the function to be numerically integrated the lower interval value. the upper interval value. the number of rectangles to be used unction Outputs: Area Riemann - the final Riemann sum approximation for the area under the curve tep 1: Apply the function from Q1 of this week's exercises tep 2: While Error is greater than 0.01, double N and then re-apply the function from Q1 ote: When a function is written below another function, the upper function can use the lower function within it. We have put the function from Q1 below area_accurate so it can be used within the while loop. Also note that the function template is done mostly for you. You just need to insert the doubling N equation and Q1 solution where specified in the late seful Functions: while, linspace, sum, abs. Function Template: function Area_Riemann area_accurate(Func,a,b,N) [Area-Riemann ,Area-integral, Error] = area(Func,a,b,N); while Error > 0.01 %double N [Area_Riemann,Area integral,Error] -area(Func,a,b,N); nd end function [Area-Riemann ,Area-integral , Error] = area(Func,a,b,N) INSERT CODE FROM YOUR Q1 solution nd unction Inputs: unc- the function to be numerically integrated the lower interval value. the upper interval value. the number of rectangles to be used unction Outputs: Area Riemann - the final Riemann sum approximation for the area under the curve tep 1: Apply the function from Q1 of this week's exercises tep 2: While Error is greater than 0.01, double N and then re-apply the function from Q1 ote: When a function is written below another function, the upper function can use the lower function within it. We have put the function from Q1 below area_accurate so it can be used within the while loop. Also note that the function template is done mostly for you. You just need to insert the doubling N equation and Q1 solution where specified in the late seful Functions: while, linspace, sum, abs. Function Template: function Area_Riemann area_accurate(Func,a,b,N) [Area-Riemann ,Area-integral, Error] = area(Func,a,b,N); while Error > 0.01 %double N [Area_Riemann,Area integral,Error] -area(Func,a,b,N); nd end function [Area-Riemann ,Area-integral , Error] = area(Func,a,b,N) INSERT CODE FROM YOUR Q1 solution nd
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
