(Numerical Integration) Suppose we are given a function f(x) whose integral is not known explicitly. We may, however, wish to still approximate the value of the definite integral of f over the...


make mathlab code


(Numerical Integration) Suppose we are given a function f(x) whose integral is not<br>known explicitly. We may, however, wish to still approximate the value of the definite<br>integral of f over the interval [a, b). In order to do this, we could use the so-called<br>composite trapezoid rule with n+1 nodes given by<br>h<br>n-1<br>[S(2) dzx = (5(a) +2E f(a + kh) +,<br>+2Ef(a + kh) + f(b<br>k=1<br>where h = b-a<br>comp_trap_rule Function:<br>Input variables:<br>• an anonymous function representing f<br>• a scalar representing the lower bound of integration a<br>• a scalar representing the upper bound of integration b<br>• a scalar representing the value of n; you may assune this is an integer<br>greater than 0<br>Output variables:<br>• a scalar representing the approximate integral computed by the formula<br>above<br>A possible sample case is:<br>> int = comp_trap_rule(@(x) x^2, 0, 1, 100)<br>int =<br>0.33335<br>

Extracted text: (Numerical Integration) Suppose we are given a function f(x) whose integral is not known explicitly. We may, however, wish to still approximate the value of the definite integral of f over the interval [a, b). In order to do this, we could use the so-called composite trapezoid rule with n+1 nodes given by h n-1 [S(2) dzx = (5(a) +2E f(a + kh) +, +2Ef(a + kh) + f(b k=1 where h = b-a comp_trap_rule Function: Input variables: • an anonymous function representing f • a scalar representing the lower bound of integration a • a scalar representing the upper bound of integration b • a scalar representing the value of n; you may assune this is an integer greater than 0 Output variables: • a scalar representing the approximate integral computed by the formula above A possible sample case is: > int = comp_trap_rule(@(x) x^2, 0, 1, 100) int = 0.33335

Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here