Answered step by step
Verified Expert Solution
Question
1 Approved Answer
please solve with matlab Aside from applying the trapezoidal rule with finer segmentation, another way to obtain a more accurate estimate of an integral is
please solve with matlab
Aside from applying the trapezoidal rule with finer segmentation, another way to obtain a more accurate estimate of an integral is to use higher-order polynomials to connect the points. Simpson's 1/3 rule results when a second-order interpolating polynomial is used. And it can be improved by dividing the integration interval into a number of segments of equal width (Multiple Segment Simpson's 1/3 Rule) Write a matlab function/code that does calculates the integral of a function in a given interval with multiple-segment Simpson's 1/3 rule, where the approximating the integral is as follows: I(ba)3nf(x0)+4i=1,3,5n1f(xi)+2j=2,4,6n2f(xj)+f(xn) Generate a matlab function/code and call it: simpson.m An algorithm (for a matlab function) you use may start as follows (you need to complete the remaining part according to Equation 1). Because of the need for three points for application of 1/3 rule each segment, the method is limited to odd number of points (even number of segments). 8Input a11 the constants in your function 8Input - f is the integrand - x0 and xn are lower and upper limits of integration - n is the number of segments output - s is the simpson rule sum s1=0; initial sum for the odd terms set to be zero s2=0; initial sum for the even terms set to be zero 8 you need to write two "for loop" for the sum of the odd and even terms COMPLETE the program script on your own 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