this is the classic euler's method, but i'd like to modify it so that it can handle two-dimensional systems on the form(adsbygoogle = window.adsbygoogle || []).push({});

x'=...

y'=...

what needs to be done?

function [X,Y] = euler1(x,y,x1,n)

h=(x1-x)/n;

X=x;

Y=y;

for i=1:n

y=y+h*f(x,y);

x=x+h;

X=[X;x];

Y=[Y;y];

end

X

Y

plot(X,Y,x,y)

function yp = f(x,y)

yp=y*sin(x);

**Physics Forums - The Fusion of Science and Community**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Euler's method for systems

Loading...

Similar Threads - Euler's method systems | Date |
---|---|

B Euler's method for second order DE | Oct 4, 2016 |

Help with implicit euler method | May 27, 2014 |

Midpoint Euler method, second order system | Jun 12, 2013 |

Backward euler method for heat equation with neumann b.c. | Mar 17, 2013 |

**Physics Forums - The Fusion of Science and Community**