Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using MATLAB: Create 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: Create 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 is the midpoint, trapezoid, and simpson's rule
Please solve using only MATLAB. Thanks!
f method (x) midpoint cos(x) -3 trapezoid cos(x) 3 Simpson (x) 0.1 0.01 0.001 theoretical int (f) %errorStep 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