Euler's method is used as the foundation for Heun's method. Euler's method uses the line tangent to the function at the beginning of the interval as an estimate of the slope of the function over the interval, assuming that if the step size is small, the error will be small. However, even when extremely small step sizes are used, over a large number of steps the error starts to accumulate and the estimate diverges from the actual functional value.
Enter initial value of x i.e. x0: 0
Enter initial value of y i.e. y0: 0.5
Enter the final value of x: 2
Enter the step length h: 0.2
2.000 7.957 >>
Manotosh Mandal (2020). Modified Euler Method (https://www.mathworks.com/matlabcentral/fileexchange/72523-modified-euler-method), MATLAB Central File Exchange. Retrieved .
Modified Euler Method for numerical differentiation with example.