Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need help on this exercise. Can we use a for loop ? (Matlab) (Matlab) Exercise 1 Consider the following integral of a function f(x) on
Need help on this exercise. Can we use a for loop ? (Matlab)
(Matlab)
Exercise 1 Consider the following integral of a function f(x) on a finite interval [a,b] I(f)f(x)dx. CL Write three Matlab/Octave functions implementing, respectively, the composite midpoint rule, the composite trapezoidal rule, and the composite Simpson rule to compute the numerical approxima- tion of I(f). Such functions should be of the form function [I]-int.midpoint.rule(fun,a,b,n)(composite midpoint rule) function [I]-int trapezoidal rule(fun,a,b,n) (composite trapezoidal rule) function [I]-int Simpson rule(fun,a,b,n) (composite Simpson rule) Input: function handle representing f (x) a,b: endpoints of the integration interval n: number of evenly-spaced points in [a, b (including endpoints) Output: I: numerical approximation of the integral (1) Exercise 1 Consider the following integral of a function f(x) on a finite interval [a,b] I(f)f(x)dx. CL Write three Matlab/Octave functions implementing, respectively, the composite midpoint rule, the composite trapezoidal rule, and the composite Simpson rule to compute the numerical approxima- tion of I(f). Such functions should be of the form function [I]-int.midpoint.rule(fun,a,b,n)(composite midpoint rule) function [I]-int trapezoidal rule(fun,a,b,n) (composite trapezoidal rule) function [I]-int Simpson rule(fun,a,b,n) (composite Simpson rule) Input: function handle representing f (x) a,b: endpoints of the integration interval n: number of evenly-spaced points in [a, b (including endpoints) Output: I: numerical approximation of the integral (1)Step 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