Euler's Method for Differential Equations in MATLAB in Bangla

Опубликовано: 01 Август 2026
на канале: Virtual Classroom
11,740
56

Here I tried to give concept about how to solve an example of Euler's Method in Numerical Analysis. Hope it will be helpful.
Our fb page:   / vcrbd  
Code of the example:
f = @(y,t) (-2*t*y);
y0=1;
t0=0;
tf=5;
h=.0001;
n =(tf-t0)/h;
yi=y0;
ti=t0;
for i=1:n
yf = yi + h*f(yi,ti);
yi=yf;
yr = exp(-ti*ti);
plot(ti,yi,'o')
hold on
plot (ti,yr,'ro')
ti=ti+h;
end
yf
yr
error =(abs (yf-yr)/yr)*100

example of Euler's Method:
Example 1 :    • Euler's Method for Differential Equations ...  
Example 2:    • Euler's Method for Differential Equations ...  

Some info:
Euler method: In mathematics and computational science, the Euler method (also called forward Euler method) is a first-order numerical procedure for solving ordinary differential equations (ODEs) with a given initial value. It is the most basic explicit method for numerical integration of ordinary differential equations and is the simplest Runge–Kutta method. The Euler method is named after Leonhard Euler, who treated it in his book Institutionum calculi integralis (published 1768–70).

The Euler method is a first-order method, which means that the local error (error per step) is proportional to the square of the step size, and the global error (error at a given time) is proportional to the step size. The Euler method often serves as the basis to construct more complex methods, e.g., predictor–corrector method.
https://en.wikipedia.org/wiki/Euler_m...
For more:http://tutorial.math.lamar.edu/Classe...