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
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com