MATLAB Trapezoidal RuleConsider the function y=f(x) for the interval a≤x≤b, shown in figure: ![]() To evaluate the definite integral, The total area is: ![]() ![]() ![]() ![]() ExampleUsing the trapezoidal rule with n=4, estimate the cost of the definite integral ![]() Compare with the exact value and evaluate the percent error. Solution: The exact value of this integral is ![]() For the trapezoidal rule approximation, we have ![]() and by substitution into an equation ![]() From equation 3 and equation 4, we find that the percent error is ![]()
Next TopicMATLAB Trapz
|