0% found this document useful (0 votes)
2 views1 page

Numerical Integration Techniques in MATLAB

The document discusses numerical integration using trapezoidal rule, Simpson's 1/3 rule, and finding the exact integral value for comparison. It provides three examples: 1) using the rules to find the distance given velocity over time, 2) finding the RMS value of a 2 sin function integrated from 0 to T, and 3) finding the area under a half-circle curve from -5 to 5 using the rules and comparing to the exact value.
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)
2 views1 page

Numerical Integration Techniques in MATLAB

The document discusses numerical integration using trapezoidal rule, Simpson's 1/3 rule, and finding the exact integral value for comparison. It provides three examples: 1) using the rules to find the distance given velocity over time, 2) finding the RMS value of a 2 sin function integrated from 0 to T, and 3) finding the area under a half-circle curve from -5 to 5 using the rules and comparing to the exact value.
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

Numerical integration:

1. Consider example 21.3 in your book. We have used trapezoidal rule to find the distance (which is
the integration of velocity over time) in class using MATLAB.
a. Use the MATLAB code to find the integral in trapezoidal rule for 𝑛 = 10.
b. Write a MATLAB code to find the integral using Simpson’s 1/3 rule for 𝑛 = 10.
c. The exact integral value is given in the book. Calculate and compare the error in both the
above-mentioned methods.

2𝜋
2. Consider: 𝑦 = 𝑓(𝑥) = 2 sin ( 5 𝑥). [here is 𝑥 is time]
a. What is the period 𝑇?
𝑇1
b. Numerically find the following integral: 𝑌 = ∫0 [𝑓(𝑥)]2 𝑑𝑥. Set 𝑛 = 1000.
𝑇
1 1 2𝜋 2 𝑇
[Hint: assume 𝑔(𝑥) = [𝑓(𝑥)]2 = [2 sin ( 𝑥)] and find 𝑌 = ∫0 𝑔(𝑥) 𝑑𝑥 ]
𝑇 𝑇 5
c. Here, 𝑌 is the RMS value of 𝑦. Using your formula of RMS learnt in EEE201, find the
error.

3. Assume the datapoints are given. To get the data, you will use the following lines in your code:

clc
close all
clear

xi = linspace(-5,5,2001);
yi = sqrt(5^2 – xi.^2);

a. Find the area under the curve using trapezoidal method. Integration limit: -5 to 5.
b. Find the area under the curve using Simpson’s 1/3 method. Integration limit: -5 to 5.
c. Plot the data. This is actually a half-circle with radius 5. So, the exact area under the
1
curve should be 2 × 𝜋 (5)2 . Does your numerical integral value closely match with this
answer?

You might also like