solving ODE using numerical methods
A most general form of an ordinary differential equation (ode) is given by f( x, y, y', . . ., y(m) ) = 0
where x is the independent variable and y is a function of x. y', y'' . . . y(m) are respectively, first, second and mth derivatives of y with respect to x. ref: https://mat.iitm.ac.in/home/sryedida/public_html/caimna/ode/intro.html
example :
program to solve 1st Order differential Equation using different numerical methods
comparing the results with ODE45 and to find max error for a user defined step size " h "
enter the function in form of @(x,y): @(x,y)cos(x)-log(y)
enter initial "x" value : 1
enter final "x" value : 3
enter initial "y" value : 1
enter "h" value : 0.1
maximum error ode45 vs Euler= 0.030403 with step size h= 0.1
maximum error ode45 vs RK-4= 1.3012e-06 with step size h= 0.1
maximum error ode45 vs Heuns(Rk-2)= 0.00095811 with step size h= 0.1
maximum error ode45 vs Midpoint= 0.0009912 with step size h= 0.1
maximum error ode45 vs Backward Eulers= 0.044459 with step size h= 0.1
Cite As
N Narayan rao (2024). solving ODE using numerical methods (https://www.mathworks.com/matlabcentral/fileexchange/60517-solving-ode-using-numerical-methods), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform Compatibility
Windows macOS LinuxCategories
- MATLAB > Mathematics > Numerical Integration and Differential Equations > Ordinary Differential Equations >
Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.