0% found this document useful (0 votes)
4 views4 pages

NC Lab12

Uploaded by

fa21-bee-030
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views4 pages

NC Lab12

Uploaded by

fa21-bee-030
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Title

Simpson’s 1/3 Rule (Numerical Integration)


1. Objective:
- To determine the area of an equation using Simpson’s 1/3 Rule.
- To understand MATLAB implementation of Simpson’s 1/3 Rule.
- To analyze the results.

2. Introduction:
Simpson’s 1/3 Rule:
Simpson’s 1/3 Rule is a method for numerical integration that provides a more accurate estimate for
the area under a curve by fitting parabolic segments instead of straight lines or rectangles. It is
especially effective for integrals of smooth functions. The basic principle involves dividing the
integration interval into an even number of subintervals (N), ensuring the use of parabolic
interpolation.

1. Integrate over an interval [a, b].


2. Divide this interval into N equal subintervals of length h = (b - a) / N, where N is even.
3. The approximate area under the curve is calculated using:
Area = (h/3) * [f(a) + 4 * sum(f(x_odd)) + 2 * sum(f(x_even)) + f(b)].

3. MATLAB Implementation:
Tasks

Task 1:
Find the area of an equation using Simpson’s 1/3 Rule.

For N=10

Code:
clc
clear all
close all

a = 0;
b = 10;
N = 10; % N must be even
h = (b - a) / N;

x = a:h:b;
y = 1 ./ (1 + (x.^2)); % Define the function

Area = (h/3) * (y(1) + 4 * sum(y(2:2:N)) + 2 * sum(y(3:2:N-1)) + y(N+1));


disp(["Area using Simpson 1/3 Rule: ", num2str(Area)])

Numerical Computations [MTH 375] Page 1


Output:
Thus the area is approximately 1.4600.

Conclusions:
- We have learned how to determine the area of an equation using Simpson’s 1/3 Rule.
- We have also implemented and verified the results using MATLAB.

Numerical Computations [MTH 375] Page 2


Title

Simpson’s 3/8 Rule (Numerical Integration)


1. Objective:
- To determine the area of an equation using Simpson’s 3/8 Rule.
- To understand MATLAB implementation of Simpson’s 3/8 Rule.
- To analyze the results.

2. Introduction:
Simpson’s 3/8 Rule:
Simpson’s 3/8 Rule is another method of numerical integration that provides a higher-order
approximation for the area under a curve by fitting cubic polynomials over three consecutive
subintervals. This method divides the integration range into multiple intervals, ensuring that
the number of subintervals (N) is a multiple of 3.

1. Integrate over an interval [a, b].


2. Divide this interval into N equal subintervals of length h = (b - a) / N, where N is a
multiple of 3
3. The approximate area under the curve is calculated using:
Area = (3*h/8) * [f(a) + 3 * sum(f(x_not_multiple_of_3)) + 2 * sum(f(x_multiple_of_3)) +
f(b)].

3. MATLAB Implementation:
Tasks

Task 1:
Find the area of an equation using Simpson’s 3/8 Rule.

For N=12

Code:
clc
clear all
close all

a = 0;
b = 10;
N = 12; % N must be a multiple of 3
h = (b - a) / N;

x = a:h:b;
y = 1 ./ (1 + (x.^2)); % Define the function

Area = (3*h/8) * (y(1) + 3 * sum(y(2:1:N)) + 2 * sum(y(4:3:N-2)) + y(N+1));


disp(["Area using Simpson 3/8 Rule: ", num2str(Area)])

Numerical Computations [MTH 375] Page 3


Output:
Thus the area is approximately 1.4598.

Conclusions:
- We have learned how to determine the area of an equation using Simpson’s 3/8 Rule.
- We have also implemented and verified the results using MATLAB.

Numerical Computations [MTH 375] Page 4

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy