Euler Method in MATLAB

1. Sep 25, 2008

blue-steel

Hi all

Im working on a systems dynamics problem which involves modelling a double pendulum, a chaotic system

I have a non linear system of 4 1st order differential equations which I need to solve using numerical methods in MATLAB

The methods are ode45, ode23s and euler method

Ive been able to model using the first 2 but am having problems with the euler method as this involves the variable 'h' in the euler algorithm and creating a unique function (as opposed to built in ones in matlab) and im not sure how to use loops and feval syntax and such

So for a system such as

x1' = f(x1,x2,x3,x4)
x2' = f(x1,x2,x3,x4)
x3' = f(x1,x2,x3,x4)
x4' = f(x1,x2,x3,x4)

How do you solve in matlab using the euler algorithm, y(i+1) = y(i) + hf(y,i)
my ultimate goal is to solve and graph points x1 and x3 with time (as these represent angles of the 2 pendulum branches)

Id appreciate any ideas on how to start with coding the euler algorithm in MATLAB and how apply user made functions, I don't know where to start......