{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Matlab_Example

# Matlab_Example - 1/3 Rule Two-point Gauss Three-pt Gauss 1...

This preview shows page 1. Sign up to view the full content.

NUMERICAL INTEGRATION OF FUNCTIONS LECTURES 25 & 26 The example below compares numerical integration results for different methods using different numbers of segments. The same function is used for all examples: f = 0.2 + 25*x - 200*x.^2 + 675*x.^3 - 900*x.^4 + 400*x.^5 This function is integrated between x = 0 and x = 0.8. Below is a graph of the function: 0 0.2 0.4 0.6 0.8 0 0.5 1 1.5 2 2.5 3 3.5 4 The exact integral (area under the curve) is 1.640533. The table below shows the true percent error as a function of number of segments for four different numerical integration methods: Number of Segments Number of Points Trapezoidal Simpson’s
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 1/3 Rule Two-point Gauss Three-pt Gauss 1 2 89.4668 0 -11.0967 -0.0000 2 3 34.8504 16.6450 -0.6936 -0.0000 3 4 16.5165 0 -0.1370 -0.0000 4 5 9.4928 1.0403 -0.0434 -0.0000 5 6 6.1353 0 -0.0178 -0.0000 6 7 4.2832 0.2055 -0.0086 -0.0000 7 8 3.1569 0 -0.0046 -0.0000 8 9 2.4220 0.0650 -0.0027 -0.0000 9 10 1.9163 0 -0.0017 -0.0000 10 11 1.5538 0.0266 -0.0011 -0.0000 11 12 1.2851 0 -0.0008 -0.0000 12 13 1.0804 0.0128 -0.0006 -0.0000 13 14 0.9210 0 -0.0004 -0.0000 14 15 0.7944 0.0069 -0.0003 -0.0000 15 16 0.6922 0 -0.0002 -0.0000 Note that for Simpson’s 1/3 rule, only even numbers of segments work. Why?...
View Full Document

{[ snackBarMessage ]}