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 | Science Articles, Homework Help, Discussion**

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

**Physics Forums | Science Articles, Homework Help, Discussion**