Thread Subject: Euler method for a system

Subject: Euler method for a system

From: Carp Fisher

Date: 7 Nov, 2009 21:08:38

Message: 1 of 2

I have the two equations:

dx/dt = -2x
dy/dt = 5x - y

x(0) = 5
y(0) = 1

for t values between 1 and 200

I want to use the Euler method to solve this system and then graph each x and y vs t.

Could someone point me to a code that could do this? Don't worry, I don't need to come up with the code myself, so helping me out here isn't contributing to cheating in anyway. Thanks,

Jim

Subject: Euler method for a system

From: Torsten Hennig

Date: 9 Nov, 2009 07:39:18

Message: 2 of 2

> I have the two equations:
>
> dx/dt = -2x
> dy/dt = 5x - y
>
> x(0) = 5
> y(0) = 1
>
> for t values between 1 and 200
>
> I want to use the Euler method to solve this system
> and then graph each x and y vs t.
>
> Could someone point me to a code that could do this?
> Don't worry, I don't need to come up with the code
> e myself, so helping me out here isn't contributing
> to cheating in anyway. Thanks,
>
> Jim

Euler explicit:
(x_{i+1}-x_{i})/dt = -2*x_{i}
(y_{i+1}-y_{i})/dt = 5*x_{i}-y_{i}

->

x_{i+1} = x_{i}*(1-2*dt)
y_{i+1} = 5*dt*x_{i}+y_{i}*(1-dt)


Euler implicit:

(x_{i+1}-x_{i})/dt = -2*x_{i+1}
(y_{i+1}-y_{i})/dt = 5*x_{i+1}-y_{i+1}

->

x_{i+1}=x_{i}/(1+2*dt)
y_{i+1}=(y_{i}+5*dt*x_{i+1})/(1+dt)

Best wishes
Torsten.

Tags for this Thread

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

rssFeed for this Thread

Contact us at files@mathworks.com