SlideShare a Scribd company logo
Chapter 08 & 09
NUMERICAL INTEGRATION
NUMERICAL INTEGRATION OF ORDINARY DIFFERENTIAL
EQUATION (ODE)
4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 1
Numerical Integration
Integration is a common mathematical operation used to
calculate area and volume, velocity from acceleration, and work
from force and displacement.
In calculus courses the integrand (the quantity to be integrated)
is usually a function. In application of science and engineering
the integrand can be a function or a set of data points.
In MATLAB built-in integration functions such as quad,
quadl and trapz are used to integrate.
The quad and quad1 commands are used for integration when
f(x) is a function, and Trapz is used when f(x) is given by data
points.
4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 2
The quad command
The form of the quad commend, which uses the adaptive Simpson
method of integration, is:
>>q=quad(function,a,b) or
>>q=quadl(function,a,b)
q=the value of the integral
function-the function to be integrated.
a & b, the integration limit.
4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 3
The quad command
The function f(x) must be written for an argument x that is a vector
(use element-by-element operations) such that it calculates the value of
the function for each element x.
The user have to make sure that the function does not have a vertical
symptote between a and b.
Quad calculates the integral with an absolute error that is smaller
than 0.0001. this number can be changed by adding an optional tol
argument to the command.
tol is a number that defines the maximum error. With larger tol
the integral is calculated less accurately but faster.
4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 4
Example 1
Use the numerical integration to calculate the following integral.
Sol.:
>>quad(‘x.*exp(-x.^0.8)+0.2’,0,8)
0.8
8
0
( 0.2)x
xe dx

4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 5
The trapz command
The trapz command can be used for integrating a function that is
given as data points.it uses the numerical trapezoidal method of
integration. The form of the command is
q=trapz(x,y)
x and y are vectors with the x and y coordinates of the points,
respectively. The two vectors must be of the same length.
4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 6
Ordinary differential
equations(ODE)
ODE’s describe a function y in terms of its derivatives.
The goal is to solve for y
3
2dy t y
dt t


4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 7
Numerical solution to ode
In general, only simple (linear) ODEs can be solved analytically.
Most interesting ODEs are nonlinear, must solve numerically.
The idea is to approximate the derivatives by subtraction.
4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 8
Steps for solving first order
ode
Step 1: write the problem in standard form,
3
2
1 3 4.2 1
dy t y
for t with y at t
dt t

    
4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 9
Steps for solving first order
ode
Step 2: Create a user-defined function (in a function file) or an
anonymous function.
Create function in .m file, for example, the user defined function
is:
function dydt=ODEexpl(t,y)
dydt=(t^3-2*y)/t;
When anonymous function is used, it can be defined in the
command window, or within the script file.
>>ode1=@(t,y)(t^3-2*y)/t
ode1 =
@(t,y)(t^3-28y)/t
4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 10
Steps for solving first order
ode
Step 3: select a method of solution,
Many numerical methods have been developed to solve the
first order ODEs, and several of the methods are available
in as built-in functions in MATLAB.
Examples: ode45, ode23, ode113, ode15s,
ode23s, ode23t,ode23tb
4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 11
Steps for solving first order
ode
Step 4: Solve the ODE
The form of the command that is used to solve an initial
value ODE problem is the same for all the solvers and for
all the equations that are solved. The form is:
>>[t,y]=solver_name(ODEfun,tspan,yo)
Solver_name: Is the name of solver such as, ode45 or ode23
ODEfun:The function that calculates the dy/dt.
tspan: A vector that specify the interval of solution.
yo: Intial value of y
[t,y]:The output which is the solution of the ODE.
4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 12
Example 2
Solve the following ODE,
3
2
1 3 4.2 1
dy t y
for t with y at t
dt t

    
4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 13
solution
function dydt=ODEexpl(t,y)
dydt=(t^3-2*y)/t;
>>[t,y]=ode45(@ODEexp1,[1:0.5:3],4.2)
t =
1.0000
1.5000
2.0000
2.5000
3.0000
y =
4.2000
2.4528
2.6000
3.7650
5.8444
4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 14
solution
The name of the user defined function in step 2 is
ODEexp1. to show the solution, the problem is solved
again below using tspan with smaller spacing, and the
solution is plotted with the plot command.
>>[t,y]=ode45(@ODEexp1,[1:0.01:3],4.2)
>>plot(t,y)
>>xlabel(‘t’), ylabel(‘y’)
4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 15
Slide ends here
Dr. Mohammed Danish
Senior lecturer, Malaysian Institute of Chemical and Bioengineering Technology (MICET), UniKL, Alor
Gajah, 78000 Melaka.
4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 16

More Related Content

What's hot

APPLICATION OF NUMERICAL METHODS IN SMALL SIZE
APPLICATION OF NUMERICAL METHODS IN SMALL SIZEAPPLICATION OF NUMERICAL METHODS IN SMALL SIZE
APPLICATION OF NUMERICAL METHODS IN SMALL SIZE
m.kumarasamy college of engineering
 
multi threaded and distributed algorithms
multi threaded and distributed algorithms multi threaded and distributed algorithms
multi threaded and distributed algorithms
Dr Shashikant Athawale
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of Algorithms
Krishnan MuthuManickam
 
Chapter 7 ds
Chapter 7 dsChapter 7 ds
Chapter 7 ds
Hanif Durad
 
Programming in python
Programming in pythonProgramming in python
Programming in python
Ivan Rojas
 
Signal Processing Assignment Help
Signal Processing Assignment HelpSignal Processing Assignment Help
Signal Processing Assignment Help
Matlab Assignment Experts
 
Chapter 4 ds
Chapter 4 dsChapter 4 ds
Chapter 4 ds
Hanif Durad
 
February 10 2016
February 10 2016February 10 2016
February 10 2016
khyps13
 
design and analysis of algorithm
design and analysis of algorithmdesign and analysis of algorithm
design and analysis of algorithm
Muhammad Arish
 
Function Basics Math Wiki
Function Basics   Math WikiFunction Basics   Math Wiki
Function Basics Math Wiki
Alec Kargodorian
 
Lectue five
Lectue fiveLectue five
Lectue five
Mahmoud Hussein
 
Recursion(Advanced data structure)
Recursion(Advanced data structure)Recursion(Advanced data structure)
Recursion(Advanced data structure)
kurubameena1
 
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsDivide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Amrinder Arora
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSGayathri Gaayu
 
Fundamental computing algorithms
Fundamental computing algorithmsFundamental computing algorithms
Fundamental computing algorithms
Ganesh Solanke
 
Big o notation
Big o notationBig o notation
Big o notation
hamza mushtaq
 
Chapter 5 ds
Chapter 5 dsChapter 5 ds
Chapter 5 ds
Hanif Durad
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
Amrinder Arora
 
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUSQUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
JAMBIKA
 

What's hot (20)

APPLICATION OF NUMERICAL METHODS IN SMALL SIZE
APPLICATION OF NUMERICAL METHODS IN SMALL SIZEAPPLICATION OF NUMERICAL METHODS IN SMALL SIZE
APPLICATION OF NUMERICAL METHODS IN SMALL SIZE
 
algorithm Unit 3
algorithm Unit 3algorithm Unit 3
algorithm Unit 3
 
multi threaded and distributed algorithms
multi threaded and distributed algorithms multi threaded and distributed algorithms
multi threaded and distributed algorithms
 
CS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of AlgorithmsCS8451 - Design and Analysis of Algorithms
CS8451 - Design and Analysis of Algorithms
 
Chapter 7 ds
Chapter 7 dsChapter 7 ds
Chapter 7 ds
 
Programming in python
Programming in pythonProgramming in python
Programming in python
 
Signal Processing Assignment Help
Signal Processing Assignment HelpSignal Processing Assignment Help
Signal Processing Assignment Help
 
Chapter 4 ds
Chapter 4 dsChapter 4 ds
Chapter 4 ds
 
February 10 2016
February 10 2016February 10 2016
February 10 2016
 
design and analysis of algorithm
design and analysis of algorithmdesign and analysis of algorithm
design and analysis of algorithm
 
Function Basics Math Wiki
Function Basics   Math WikiFunction Basics   Math Wiki
Function Basics Math Wiki
 
Lectue five
Lectue fiveLectue five
Lectue five
 
Recursion(Advanced data structure)
Recursion(Advanced data structure)Recursion(Advanced data structure)
Recursion(Advanced data structure)
 
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of PointsDivide and Conquer - Part II - Quickselect and Closest Pair of Points
Divide and Conquer - Part II - Quickselect and Closest Pair of Points
 
DESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMSDESIGN AND ANALYSIS OF ALGORITHMS
DESIGN AND ANALYSIS OF ALGORITHMS
 
Fundamental computing algorithms
Fundamental computing algorithmsFundamental computing algorithms
Fundamental computing algorithms
 
Big o notation
Big o notationBig o notation
Big o notation
 
Chapter 5 ds
Chapter 5 dsChapter 5 ds
Chapter 5 ds
 
Greedy Algorithms
Greedy AlgorithmsGreedy Algorithms
Greedy Algorithms
 
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUSQUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
 

Similar to 08-09 Chapter numerical integration

MATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docx
MATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docxMATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docx
MATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docx
andreecapon
 
Problem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialProblem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study material
To Sum It Up
 
MATLAB ODE
MATLAB ODEMATLAB ODE
MATLAB ODE
Kris014
 
Signals And Systems Lab Manual, R18 Batch
Signals And Systems Lab Manual, R18 BatchSignals And Systems Lab Manual, R18 Batch
Signals And Systems Lab Manual, R18 Batch
Amairullah Khan Lodhi
 
Chapter 2 ds
Chapter 2 dsChapter 2 ds
Chapter 2 ds
Hanif Durad
 
Basic concept of MATLAB.ppt
Basic concept of MATLAB.pptBasic concept of MATLAB.ppt
Basic concept of MATLAB.ppt
aliraza2732
 
03 Chapter MATLAB finite precision arithmatic
03 Chapter MATLAB finite precision arithmatic03 Chapter MATLAB finite precision arithmatic
03 Chapter MATLAB finite precision arithmatic
Dr. Mohammed Danish
 
Dsp manual completed2
Dsp manual completed2Dsp manual completed2
Dsp manual completed2bilawalali74
 
A MATLAB project on LCR circuits
A MATLAB project on LCR circuitsA MATLAB project on LCR circuits
A MATLAB project on LCR circuits
svrohith 9
 
Runge Kutta Method
Runge Kutta MethodRunge Kutta Method
Runge Kutta Method
Saloni Singhal
 
Recursion in Java
Recursion in JavaRecursion in Java
Recursion in Java
Fulvio Corno
 
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhhCh3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
danielgetachew0922
 
02 MATLAB programming
02 MATLAB programming02 MATLAB programming
02 MATLAB programming
Dr. Mohammed Danish
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
BilawalBaloch1
 
VCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxVCE Unit 01 (2).pptx
VCE Unit 01 (2).pptx
skilljiolms
 
Matlab II
Matlab IIMatlab II
Matlab II
Kelin Jose
 
Digital Signal Processing Lab Manual
Digital Signal Processing Lab Manual Digital Signal Processing Lab Manual
Digital Signal Processing Lab Manual
Amairullah Khan Lodhi
 
AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...
AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...
AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...
ijdpsjournal
 
AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...
AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...
AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...
ijdpsjournal
 

Similar to 08-09 Chapter numerical integration (20)

MATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docx
MATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docxMATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docx
MATLAB sessions Laboratory 4MAT 275 Laboratory 4MATLAB .docx
 
Problem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study materialProblem solving using computers - Unit 1 - Study material
Problem solving using computers - Unit 1 - Study material
 
MATLAB ODE
MATLAB ODEMATLAB ODE
MATLAB ODE
 
Signals And Systems Lab Manual, R18 Batch
Signals And Systems Lab Manual, R18 BatchSignals And Systems Lab Manual, R18 Batch
Signals And Systems Lab Manual, R18 Batch
 
Chapter 2 ds
Chapter 2 dsChapter 2 ds
Chapter 2 ds
 
Basic concept of MATLAB.ppt
Basic concept of MATLAB.pptBasic concept of MATLAB.ppt
Basic concept of MATLAB.ppt
 
03 Chapter MATLAB finite precision arithmatic
03 Chapter MATLAB finite precision arithmatic03 Chapter MATLAB finite precision arithmatic
03 Chapter MATLAB finite precision arithmatic
 
Dsp manual completed2
Dsp manual completed2Dsp manual completed2
Dsp manual completed2
 
A MATLAB project on LCR circuits
A MATLAB project on LCR circuitsA MATLAB project on LCR circuits
A MATLAB project on LCR circuits
 
Runge Kutta Method
Runge Kutta MethodRunge Kutta Method
Runge Kutta Method
 
Recursion in Java
Recursion in JavaRecursion in Java
Recursion in Java
 
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhhCh3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
 
Es272 ch1
Es272 ch1Es272 ch1
Es272 ch1
 
02 MATLAB programming
02 MATLAB programming02 MATLAB programming
02 MATLAB programming
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
VCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxVCE Unit 01 (2).pptx
VCE Unit 01 (2).pptx
 
Matlab II
Matlab IIMatlab II
Matlab II
 
Digital Signal Processing Lab Manual
Digital Signal Processing Lab Manual Digital Signal Processing Lab Manual
Digital Signal Processing Lab Manual
 
AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...
AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...
AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...
 
AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...
AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...
AN EFFICIENT PARALLEL ALGORITHM FOR COMPUTING DETERMINANT OF NON-SQUARE MATRI...
 

More from Dr. Mohammed Danish

Instrumental method of analysis Oil and Fat(Unit 7 b)
Instrumental method of analysis Oil and Fat(Unit 7 b)Instrumental method of analysis Oil and Fat(Unit 7 b)
Instrumental method of analysis Oil and Fat(Unit 7 b)
Dr. Mohammed Danish
 
Analysis of oil and Fat(Unit 7)
Analysis of oil and Fat(Unit 7)Analysis of oil and Fat(Unit 7)
Analysis of oil and Fat(Unit 7)
Dr. Mohammed Danish
 
Non edible application of oil and Fat (Unit 6 b)
Non edible application of oil and Fat (Unit 6 b)Non edible application of oil and Fat (Unit 6 b)
Non edible application of oil and Fat (Unit 6 b)
Dr. Mohammed Danish
 
Oil and Fat edible applications (Unit 6 a)
Oil and Fat edible applications (Unit 6 a)Oil and Fat edible applications (Unit 6 a)
Oil and Fat edible applications (Unit 6 a)
Dr. Mohammed Danish
 
Fatty acid reaction and derivatives (Unit 5 b)
 Fatty acid reaction and derivatives (Unit 5 b) Fatty acid reaction and derivatives (Unit 5 b)
Fatty acid reaction and derivatives (Unit 5 b)
Dr. Mohammed Danish
 
Fatty acid clusters (Unit 5 a)
Fatty acid clusters (Unit 5 a) Fatty acid clusters (Unit 5 a)
Fatty acid clusters (Unit 5 a)
Dr. Mohammed Danish
 
Production of Glycerin (Unit 4 b)
Production of Glycerin (Unit 4 b) Production of Glycerin (Unit 4 b)
Production of Glycerin (Unit 4 b)
Dr. Mohammed Danish
 
Fatty Acid Isolation (Unit 4 a)
Fatty Acid Isolation (Unit 4 a)Fatty Acid Isolation (Unit 4 a)
Fatty Acid Isolation (Unit 4 a)
Dr. Mohammed Danish
 
Processing of edible oil (Unit 3)
Processing of edible oil (Unit 3)Processing of edible oil (Unit 3)
Processing of edible oil (Unit 3)
Dr. Mohammed Danish
 
Chemical and Physical properties of Oil and Fat (Unit 2)
Chemical and Physical properties of Oil and Fat (Unit 2)Chemical and Physical properties of Oil and Fat (Unit 2)
Chemical and Physical properties of Oil and Fat (Unit 2)
Dr. Mohammed Danish
 
Introduction of Edible oils (Unit 1)
Introduction of Edible oils (Unit 1) Introduction of Edible oils (Unit 1)
Introduction of Edible oils (Unit 1)
Dr. Mohammed Danish
 
01 Chapter MATLAB introduction
01 Chapter MATLAB introduction01 Chapter MATLAB introduction
01 Chapter MATLAB introduction
Dr. Mohammed Danish
 
06-07 Chapter interpolation in MATLAB
06-07 Chapter interpolation in MATLAB06-07 Chapter interpolation in MATLAB
06-07 Chapter interpolation in MATLAB
Dr. Mohammed Danish
 
05 Chapter MATLAB Differntial equations
05 Chapter MATLAB Differntial equations05 Chapter MATLAB Differntial equations
05 Chapter MATLAB Differntial equations
Dr. Mohammed Danish
 
04 Chapter MATLAB linear algebra review
04 Chapter MATLAB linear algebra review04 Chapter MATLAB linear algebra review
04 Chapter MATLAB linear algebra review
Dr. Mohammed Danish
 

More from Dr. Mohammed Danish (15)

Instrumental method of analysis Oil and Fat(Unit 7 b)
Instrumental method of analysis Oil and Fat(Unit 7 b)Instrumental method of analysis Oil and Fat(Unit 7 b)
Instrumental method of analysis Oil and Fat(Unit 7 b)
 
Analysis of oil and Fat(Unit 7)
Analysis of oil and Fat(Unit 7)Analysis of oil and Fat(Unit 7)
Analysis of oil and Fat(Unit 7)
 
Non edible application of oil and Fat (Unit 6 b)
Non edible application of oil and Fat (Unit 6 b)Non edible application of oil and Fat (Unit 6 b)
Non edible application of oil and Fat (Unit 6 b)
 
Oil and Fat edible applications (Unit 6 a)
Oil and Fat edible applications (Unit 6 a)Oil and Fat edible applications (Unit 6 a)
Oil and Fat edible applications (Unit 6 a)
 
Fatty acid reaction and derivatives (Unit 5 b)
 Fatty acid reaction and derivatives (Unit 5 b) Fatty acid reaction and derivatives (Unit 5 b)
Fatty acid reaction and derivatives (Unit 5 b)
 
Fatty acid clusters (Unit 5 a)
Fatty acid clusters (Unit 5 a) Fatty acid clusters (Unit 5 a)
Fatty acid clusters (Unit 5 a)
 
Production of Glycerin (Unit 4 b)
Production of Glycerin (Unit 4 b) Production of Glycerin (Unit 4 b)
Production of Glycerin (Unit 4 b)
 
Fatty Acid Isolation (Unit 4 a)
Fatty Acid Isolation (Unit 4 a)Fatty Acid Isolation (Unit 4 a)
Fatty Acid Isolation (Unit 4 a)
 
Processing of edible oil (Unit 3)
Processing of edible oil (Unit 3)Processing of edible oil (Unit 3)
Processing of edible oil (Unit 3)
 
Chemical and Physical properties of Oil and Fat (Unit 2)
Chemical and Physical properties of Oil and Fat (Unit 2)Chemical and Physical properties of Oil and Fat (Unit 2)
Chemical and Physical properties of Oil and Fat (Unit 2)
 
Introduction of Edible oils (Unit 1)
Introduction of Edible oils (Unit 1) Introduction of Edible oils (Unit 1)
Introduction of Edible oils (Unit 1)
 
01 Chapter MATLAB introduction
01 Chapter MATLAB introduction01 Chapter MATLAB introduction
01 Chapter MATLAB introduction
 
06-07 Chapter interpolation in MATLAB
06-07 Chapter interpolation in MATLAB06-07 Chapter interpolation in MATLAB
06-07 Chapter interpolation in MATLAB
 
05 Chapter MATLAB Differntial equations
05 Chapter MATLAB Differntial equations05 Chapter MATLAB Differntial equations
05 Chapter MATLAB Differntial equations
 
04 Chapter MATLAB linear algebra review
04 Chapter MATLAB linear algebra review04 Chapter MATLAB linear algebra review
04 Chapter MATLAB linear algebra review
 

Recently uploaded

Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
Subhajit Sahu
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
AbhimanyuSinha9
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
u86oixdj
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
ewymefz
 
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Subhajit Sahu
 
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
u86oixdj
 
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
v3tuleee
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
ewymefz
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP
 
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptxData_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
AnirbanRoy608946
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
Timothy Spann
 
The Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series DatabaseThe Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series Database
javier ramirez
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
axoqas
 
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
74nqk8xf
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
haila53
 
Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
balafet
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
John Andrews
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
NABLAS株式会社
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
slg6lamcq
 
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
2023240532
 

Recently uploaded (20)

Adjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTESAdjusting primitives for graph : SHORT REPORT / NOTES
Adjusting primitives for graph : SHORT REPORT / NOTES
 
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...Best best suvichar in gujarati english meaning of this sentence as Silk road ...
Best best suvichar in gujarati english meaning of this sentence as Silk road ...
 
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
原版制作(Deakin毕业证书)迪肯大学毕业证学位证一模一样
 
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
 
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
Algorithmic optimizations for Dynamic Levelwise PageRank (from STICD) : SHORT...
 
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
原版制作(swinburne毕业证书)斯威本科技大学毕业证毕业完成信一模一样
 
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理一比一原版(UofS毕业证书)萨省大学毕业证如何办理
一比一原版(UofS毕业证书)萨省大学毕业证如何办理
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptxData_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
Data_and_Analytics_Essentials_Architect_an_Analytics_Platform.pptx
 
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
06-04-2024 - NYC Tech Week - Discussion on Vector Databases, Unstructured Dat...
 
The Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series DatabaseThe Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series Database
 
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
哪里卖(usq毕业证书)南昆士兰大学毕业证研究生文凭证书托福证书原版一模一样
 
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
 
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdfCh03-Managing the Object-Oriented Information Systems Project a.pdf
Ch03-Managing the Object-Oriented Information Systems Project a.pdf
 
Machine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptxMachine learning and optimization techniques for electrical drives.pptx
Machine learning and optimization techniques for electrical drives.pptx
 
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
Chatty Kathy - UNC Bootcamp Final Project Presentation - Final Version - 5.23...
 
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
【社内勉強会資料_Octo: An Open-Source Generalist Robot Policy】
 
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
一比一原版(Adelaide毕业证书)阿德莱德大学毕业证如何办理
 
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
Quantitative Data AnalysisReliability Analysis (Cronbach Alpha) Common Method...
 

08-09 Chapter numerical integration

  • 1. Chapter 08 & 09 NUMERICAL INTEGRATION NUMERICAL INTEGRATION OF ORDINARY DIFFERENTIAL EQUATION (ODE) 4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 1
  • 2. Numerical Integration Integration is a common mathematical operation used to calculate area and volume, velocity from acceleration, and work from force and displacement. In calculus courses the integrand (the quantity to be integrated) is usually a function. In application of science and engineering the integrand can be a function or a set of data points. In MATLAB built-in integration functions such as quad, quadl and trapz are used to integrate. The quad and quad1 commands are used for integration when f(x) is a function, and Trapz is used when f(x) is given by data points. 4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 2
  • 3. The quad command The form of the quad commend, which uses the adaptive Simpson method of integration, is: >>q=quad(function,a,b) or >>q=quadl(function,a,b) q=the value of the integral function-the function to be integrated. a & b, the integration limit. 4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 3
  • 4. The quad command The function f(x) must be written for an argument x that is a vector (use element-by-element operations) such that it calculates the value of the function for each element x. The user have to make sure that the function does not have a vertical symptote between a and b. Quad calculates the integral with an absolute error that is smaller than 0.0001. this number can be changed by adding an optional tol argument to the command. tol is a number that defines the maximum error. With larger tol the integral is calculated less accurately but faster. 4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 4
  • 5. Example 1 Use the numerical integration to calculate the following integral. Sol.: >>quad(‘x.*exp(-x.^0.8)+0.2’,0,8) 0.8 8 0 ( 0.2)x xe dx  4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 5
  • 6. The trapz command The trapz command can be used for integrating a function that is given as data points.it uses the numerical trapezoidal method of integration. The form of the command is q=trapz(x,y) x and y are vectors with the x and y coordinates of the points, respectively. The two vectors must be of the same length. 4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 6
  • 7. Ordinary differential equations(ODE) ODE’s describe a function y in terms of its derivatives. The goal is to solve for y 3 2dy t y dt t   4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 7
  • 8. Numerical solution to ode In general, only simple (linear) ODEs can be solved analytically. Most interesting ODEs are nonlinear, must solve numerically. The idea is to approximate the derivatives by subtraction. 4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 8
  • 9. Steps for solving first order ode Step 1: write the problem in standard form, 3 2 1 3 4.2 1 dy t y for t with y at t dt t       4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 9
  • 10. Steps for solving first order ode Step 2: Create a user-defined function (in a function file) or an anonymous function. Create function in .m file, for example, the user defined function is: function dydt=ODEexpl(t,y) dydt=(t^3-2*y)/t; When anonymous function is used, it can be defined in the command window, or within the script file. >>ode1=@(t,y)(t^3-2*y)/t ode1 = @(t,y)(t^3-28y)/t 4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 10
  • 11. Steps for solving first order ode Step 3: select a method of solution, Many numerical methods have been developed to solve the first order ODEs, and several of the methods are available in as built-in functions in MATLAB. Examples: ode45, ode23, ode113, ode15s, ode23s, ode23t,ode23tb 4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 11
  • 12. Steps for solving first order ode Step 4: Solve the ODE The form of the command that is used to solve an initial value ODE problem is the same for all the solvers and for all the equations that are solved. The form is: >>[t,y]=solver_name(ODEfun,tspan,yo) Solver_name: Is the name of solver such as, ode45 or ode23 ODEfun:The function that calculates the dy/dt. tspan: A vector that specify the interval of solution. yo: Intial value of y [t,y]:The output which is the solution of the ODE. 4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 12
  • 13. Example 2 Solve the following ODE, 3 2 1 3 4.2 1 dy t y for t with y at t dt t       4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 13
  • 15. solution The name of the user defined function in step 2 is ODEexp1. to show the solution, the problem is solved again below using tspan with smaller spacing, and the solution is plotted with the plot command. >>[t,y]=ode45(@ODEexp1,[1:0.01:3],4.2) >>plot(t,y) >>xlabel(‘t’), ylabel(‘y’) 4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 15
  • 16. Slide ends here Dr. Mohammed Danish Senior lecturer, Malaysian Institute of Chemical and Bioengineering Technology (MICET), UniKL, Alor Gajah, 78000 Melaka. 4/5/2016 DR. MOHAMMED DANISH/ UNIKL-MICET 16