Answered step by step
Verified Expert Solution
Link Copied!

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:

image text in transcribed

*Here is the midpoint, trapezoid, and simpson's rule

image text in transcribed

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) %error

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro PowerShell For Database Developers

Authors: Bryan P Cafferky

1st Edition

1484205413, 9781484205419

More Books

Students also viewed these Databases questions

Question

1. What is Ebola ? 2.Heart is a muscle? 3. Artificial lighting?

Answered: 1 week ago