Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Trapezoidal rule Create a MATLAB function [ DLV ] integrateTrap ( ) , which takes and integrates an input function using the trapezoidal rule. The

Trapezoidal rule
Create a MATLAB function [DLV]integrateTrap(), which takes and integrates an input function using the trapezoidal rule.
The input arguments are: a function, the step width h, lower bound, and
upper bound of the integration interval, in that order (4 total).
The output of the function is the integral of the input function between the
lower bound and the upper bound.
Use this MATLAB function to numerically calculate the integral of the function f(x)= e^(2*x) across the interval [-5,5] with step widths h =0.1,0.01, and 0.001. Plot the following in GnuPlot [DLV]:
The input function (e^2x) across the interval;
The numerical integral values (calculated in MATLAB) in form of a bar
graph for each step width h together with the analytical integral value
also as a bar graph next to each numerical integral bar graph.
Make the plot look as clean as you can: give it a legend and ensure that the numerical integral bar graphs have a different color than the
analytical integral bar graphs.
2) SimpsonRule
Create another MATLAB function [DLV]integrateSimpson() just as in 1), which takes the same input arguments. Create the same plot required in question 1)[DLV] for the 3 step widths h

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_2

Step: 3

blur-text-image_3

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

Database Application Development And Design

Authors: Michael V. Mannino

1st Edition

0072463678, 978-0072463675

More Books

Students also viewed these Databases questions