Question: Based on what is learned in class about the left - Riemann sum algorithm, construct a MATLAB function ( numerical solver ) that performs the

Based on what is learned in class about the left-Riemann sum algorithm, construct a MATLAB
function (numerical solver) that performs the numerical integration using the right Riemann
sum. The formula (algorithm) for the composite right Riemann sum for a set of +1 equally
spaced data points (or discretized domain points) is:
=()
\cong ()
+1
=2
This numerical solver has the following input/output structure:
function [I]= frmrsum(fun,a,b,N)
where fun is an anonymous function and x is a vector of the values for the discretized domain. Note
that =+1 is the step size of the subinterval between and +1.
Critical thinking: Follow the example discussed in class for the left Riemann sum. Both the left and
right Riemann sums represent numerical algorithms, which when coded properly, can be used to
perform numerical integration of functions that cannot be evaluated analytically.
The key is to understand that functions are blind to their input variables (the input variables could
also include functions as in this case). In other words, while the output results depend on the inputs, the
algorithms are independent of the inputs.
Learn how (and why) to define inputs for functions and how to perform the summation in this
algorithm using the MATLAB function sum instead of a for-loop to understand and appreciate the
simplicity and intuitiveness of MATLAB programming.
Instructor: Professor C. A. Tan Copyrighted Materials Lab-Homework 01
ME2500: Numerical Methods Using MATLAB Winter 2024 Term
Lab-HW01 In-Lab and Post-Lab Page 11 of 11
b) The force per unit length that is exerted by the wind
on a 26 ft tall sail as a function of its height is given by:
=175
+5/9 lb/ft
The total force F on the sail is calculated by:
=
26
0
Estimate the total force by applying the right Riemann sum with 10 subintervals (=10).
Compare your result with that obtained by the MATLAB built-in function integral. Assume that
the result from applying the function integral is exact, what is the relative percentage error in
using the Riemann sum with 10 subintervals?
c) Increase to 50, what is the relative percentage of error? Plot the relative percentage error as a
function of up to 100

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!