Problem 2 Construction Functions Numerical Solvers Numerical Computations Based Learned Cl Q43857815

Problem 2: Construction of functions (numerical solvers) for numerical computations a) 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 N+1 equally spaced data points (or discretized domain points) is: N+1 = f(x)h k=2 1 => s«x) dx = f(x)h f(x) a Evaluate ( f(x) dx Ja where a=x, b = XN+I X, X2 X3 — XN-1 XN XNti N sub intervals This numerical solver has the following input/output structure: function I = RightRiemann Sum (fun, a, b, N) where fun is an anonymous function and x is a vector of the values for the discretized domain. Note that h=Xk+1 – xk is the step size of the subinterval between xk and Xk+1 · Show transcribed image text Problem 2: Construction of functions (numerical solvers) for numerical computations a) 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 N+1 equally spaced data points (or discretized domain points) is: N+1 = f(x)h k=2 1 => s«x) dx = f(x)h f(x) a Evaluate ( f(x) dx Ja where a=x, b = XN+I X, X2 X3 — XN-1 XN XNti N sub intervals This numerical solver has the following input/output structure: function I = RightRiemann Sum (fun, a, b, N) where fun is an anonymous function and x is a vector of the values for the discretized domain. Note that h=Xk+1 – xk is the step size of the subinterval between xk and Xk+1 ·
Expert Answer
Answer to Problem 2: Construction of functions (numerical solvers) for numerical computations a) Based on what is learned in class…
OR