Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!