Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Part 1 : Multiple Segment Simpson's 1 / 3 Rule Aside from applying the trapezoidal rule with finer segmentation, another way to obtain a more

Part
1
: Multiple Segment Simpson's
1
/
3
Rule
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:
~
=
(
-
)
(
0
)
+
4
=
1
-
1
,
3
,
5
(
)
+
2
=
2
-
2
,
4
,
6
(
)
+
(
)
3
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
)
.
sinput
-
all the constants in your function
sinput
-
is the integrand
0
and
are lower and upper limits of integration
is the number of segments
Output
-
is the simpson rule sum.
sl
=
0
; in inial sum for the odd terms set to be zero
2
=
0
;
initial sum for the even terms set to be zero
s 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

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

JDBC Database Programming With J2ee

Authors: Art Taylor

1st Edition

0130453234, 978-0130453235

More Books

Students also viewed these Databases questions