Question: Using MATLAB: Make a script (int.m) that accepts a function f(x) and stepsize h then calculates the integral using the Midpoint rule, Trapezoid rule and
Using MATLAB: Make a script (int.m) that accepts a function f(x) and stepsize h then calculates the integral using the Midpoint rule, Trapezoid rule and Simpsons rule. Run this script for h = 1, 0.1, 0.01, 0.001 and write this data to a file (int.txt). The data file should have the following header values:

Here are the formulas for midpoint, trapezoid, and simpson's rule

Please only solve using MATLAB. Thanks!
f method (x) midpoint cos(x) -3 trapezoid cos(x) 3 Simpson (x) 0.1 0.01 0.001 theoretical int (f) %error
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
