Solving coupled 1st ODEs with ODE45 or Runge-Kutta?

1 view (last 30 days)
Hi there, I am having to solve a simple problem where I am equating Newtons's Second Law to the Lorenz Force on a particle: F = ma = -eE
d2x/dt2 = (e/m)*E0cos(omega*t) x(t=0)=0; dx/dt(t=0)=0 (so at t=0: posn=0 and velocity=0)
Pretty simple right? Well doesn't seem so! I am getting strange results when I solve this with my RK4 routine.
I split in to two couples 1st ODEs:
x1p = x2 x2p = (e/m)E0cos(omega*t)
where x1=x, x1p=x2, x2p=(d2x/dt2)=(e/m)E0cos(omega*t)
Is it possible to use the ODE45 to solve coupled 1st ODEs? What would your advice be?
Thanks in advance, Martin

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!