SlideShare a Scribd company logo
1 of 16
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

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 AlgorithmsKrishnan MuthuManickam
 
Programming in python
Programming in pythonProgramming in python
Programming in pythonIvan Rojas
 
February 10 2016
February 10 2016February 10 2016
February 10 2016khyps13
 
design and analysis of algorithm
design and analysis of algorithmdesign and analysis of algorithm
design and analysis of algorithmMuhammad Arish
 
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 PointsAmrinder 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 algorithmsGanesh Solanke
 
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUSQUESTION BANK FOR ANNA UNNIVERISTY SYLLABUS
QUESTION BANK FOR ANNA UNNIVERISTY SYLLABUSJAMBIKA
 

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 .docxandreecapon
 
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 materialTo Sum It Up
 
MATLAB ODE
MATLAB ODEMATLAB ODE
MATLAB ODEKris014
 
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 BatchAmairullah Khan Lodhi
 
Basic concept of MATLAB.ppt
Basic concept of MATLAB.pptBasic concept of MATLAB.ppt
Basic concept of MATLAB.pptaliraza2732
 
03 Chapter MATLAB finite precision arithmatic
03 Chapter MATLAB finite precision arithmatic03 Chapter MATLAB finite precision arithmatic
03 Chapter MATLAB finite precision arithmaticDr. 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 circuitssvrohith 9
 
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhhCh3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhh
Ch3(1).pptxbbbbbbbbbbbbbbbbbbbhhhhhhhhhhdanielgetachew0922
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabBilawalBaloch1
 
VCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxVCE Unit 01 (2).pptx
VCE Unit 01 (2).pptxskilljiolms
 
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
 
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
 
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
 
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
 
06-07 Chapter interpolation in MATLAB
06-07 Chapter interpolation in MATLAB06-07 Chapter interpolation in MATLAB
06-07 Chapter interpolation in MATLABDr. Mohammed Danish
 
05 Chapter MATLAB Differntial equations
05 Chapter MATLAB Differntial equations05 Chapter MATLAB Differntial equations
05 Chapter MATLAB Differntial equationsDr. Mohammed Danish
 
04 Chapter MATLAB linear algebra review
04 Chapter MATLAB linear algebra review04 Chapter MATLAB linear algebra review
04 Chapter MATLAB linear algebra reviewDr. 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

VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...SUHANI PANDEY
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxolyaivanovalion
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxolyaivanovalion
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightDelhi Call girls
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...shivangimorya083
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Researchmichael115558
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionfulawalesam
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxMohammedJunaid861692
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfLars Albertsson
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfMarinCaroMartnezBerg
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Valters Lauzums
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfadriantubila
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Delhi Call girls
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% SecurePooja Nehwal
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 

Recently uploaded (20)

VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
VIP Model Call Girls Hinjewadi ( Pune ) Call ON 8005736733 Starting From 5K t...
 
Carero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptxCarero dropshipping via API with DroFx.pptx
Carero dropshipping via API with DroFx.pptx
 
Mature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptxMature dropshipping via API with DroFx.pptx
Mature dropshipping via API with DroFx.pptx
 
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 nightCheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
Cheap Rate Call girls Sarita Vihar Delhi 9205541914 shot 1500 night
 
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...Vip Model  Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
Vip Model Call Girls (Delhi) Karol Bagh 9711199171✔️Body to body massage wit...
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
Discover Why Less is More in B2B Research
Discover Why Less is More in B2B ResearchDiscover Why Less is More in B2B Research
Discover Why Less is More in B2B Research
 
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts ServiceCall Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
Call Girls In Shalimar Bagh ( Delhi) 9953330565 Escorts Service
 
Week-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interactionWeek-01-2.ppt BBB human Computer interaction
Week-01-2.ppt BBB human Computer interaction
 
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptxBPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
BPAC WITH UFSBI GENERAL PRESENTATION 18_05_2017-1.pptx
 
Schema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdfSchema on read is obsolete. Welcome metaprogramming..pdf
Schema on read is obsolete. Welcome metaprogramming..pdf
 
FESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdfFESE Capital Markets Fact Sheet 2024 Q1.pdf
FESE Capital Markets Fact Sheet 2024 Q1.pdf
 
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
Digital Advertising Lecture for Advanced Digital & Social Media Strategy at U...
 
Sampling (random) method and Non random.ppt
Sampling (random) method and Non random.pptSampling (random) method and Non random.ppt
Sampling (random) method and Non random.ppt
 
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdfAccredited-Transport-Cooperatives-Jan-2021-Web.pdf
Accredited-Transport-Cooperatives-Jan-2021-Web.pdf
 
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in  KishangarhDelhi 99530 vip 56974 Genuine Escort Service Call Girls in  Kishangarh
Delhi 99530 vip 56974 Genuine Escort Service Call Girls in Kishangarh
 
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
Call Girls in Sarai Kale Khan Delhi 💯 Call Us 🔝9205541914 🔝( Delhi) Escorts S...
 
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% SecureCall me @ 9892124323  Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
Call me @ 9892124323 Cheap Rate Call Girls in Vashi with Real Photo 100% Secure
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 

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