Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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 leftRiemann 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 equally
spaced data points or discretized domain points is:
cong
This numerical solver has the following inputoutput structure:
function I frmrsumfunabN
where fun is an anonymous function and x is a vector of the values for the discretized domain. Note
that is the step size of the subinterval between and
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 forloop to understand and appreciate the
simplicity and intuitiveness of MATLAB programming.
Instructor: Professor C A Tan Copyrighted Materials LabHomework
ME: Numerical Methods Using MATLAB Winter Term
LabHW InLab and PostLab Page of
b The force per unit length that is exerted by the wind
on a ft tall sail as a function of its height is given by:
lbft
The total force F on the sail is calculated by:
Estimate the total force by applying the right Riemann sum with subintervals
Compare your result with that obtained by the MATLAB builtin 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 subintervals?
c Increase to what is the relative percentage of error? Plot the relative percentage error as a
function of up to
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started