1 views

Uploaded by dai83

Euler method

save

- Cable
- TE Industrial
- 329-outline-2011
- 8 Differential Equations
- Higher-Order Finite Element Methods - Pavel Solin
- Differential Equation Manual Ledder_SSM
- 1-s2.0-S1474667015365277-main.pdf
- chpter 6 1
- Teaching Mathematics in Engineering Education Through Technology
- 18_032006L02
- Individual Assignment
- Cosmos 2006
- matlab tutorial
- Sem 1
- PHW#3
- 1-s2.0-0377042795001603-main.pdf
- Economics Homework Sample problems with Solutions
- Chap01 Intro
- precalculus
- CSE Proposed 3rd Year Syllabus 19.06.12
- l t 5 4 lesson plan
- ANOTHER INTEGER NUMBER ALGORITHM TO SOLVE LINEAR EQUATIONS (USING CONGRUENCY)
- sdarticle
- Stationary States
- Modified Finite Difference Schemes on Uniform Grids for Simulations of the Helmholtz Equation at Any Wave Number – Wajid Et Al - 2014
- c5
- nbsbulletinv12n4p583_A2b
- LudkovskiThesis
- Math Catalog
- Simulation of VOC emissionsfrombuildingmaterialsbyusingthe state-spacemethod
- Guía-SEO-Nivel-Avanzado.pdf
- Por Que e Como Rezar a Liturgia Das Horas - Helber Clayton
- El amor.docx
- Feftraru, el Toqui
- _Pijamas Dolce d'Amore
- offf road.pdf
- TL Sika Geotekstil 200 300 400 500.pdf
- Altavoz
- veus del cor san fernando.pdf
- Formato_plan_de_negocios.pdf
- Modul P1 SPO 2018.pdf
- histoquisp1.pptx
- cotação3
- Natal
- Patología Articular en El Equino de Deporte
- BAB VI. TA2. (90%).docx
- 249418313-Case-2-Reposition-the-Horlicks-2.docx
- Revisão e exoneração de alimentos.docx
- Simbologia.pdf
- Tarea # 3 e. Personalidad
- WORD1_1.pdf
- godelier.docx
- chksmns.pdf
- TUGAS TAMBAHAN.pdf
- ANTISEPTICOS.pptx
- Home Visit Riska
- electronic component.pdf
- BAB IV.pdf
- 433429.pdf
- A Poesia Interminável
- Tap Chart
- P3TFA22CAAN
- Simple Cantilever Test
- Block Diagram
- Soution
- MECH_4841_B_(3118662)
- Euro-Divers Meeru English 12% GST
- Motors and Pumps Control Basic
- 3D_CVM_CVM_1-208979-0_AE
- MICHELIN Guide Kyoto Osaka Kobe Nara 2013 Selection List
- Wiring Circuits From Schematics
- DG 9 english.pdf
- 1k 2k Finish on Stainless Steel Sheet and Plate Why is It So Important
- 28400_EN
- EMC Cable Glands
- Tap Chart
- Sol_5_Ch16
- Ironman lego manual
- E-5 System Chart en FR ES
- Wind Turbine Feedback
- ÉñµñÏÀÂÂ
- 神雕侠侣_第一部
- Soution 4.8.2013
- Problem 7+10
- Gantt Chart
- Pneumatic Valves
- Feedback
- Simple Cantilever Test
- Feedbacks Out i On

You are on page 1of 5

**10. Integration Methods: Euler Method
**

The purpose of this tutorial is to describe how an initial value problem can be solved using Euler's

method, with implementation in Matlab. Many students find it easiest to learn to use Matlab through

examples rather than flipping through a manual to learn the syntax, command names, etc., so the

Matlab code for simple examples will be given.

10.1 Euler's Method

Consider the initial value problem

(1)

Suppose we write the Taylor exansion of the solution:

(2)

Truncating and using (1), we obtain the formula for Euler's method for the numerical solution of

differential equations:

(3)

Of course, there is nothing special about , so, letting , , we obtain

(4)

By iterating, we find an approximation to the solution ( ) y t of (1). Here is known as the

stepsize.

10.2 An Example

As an example, suppose we want to solve the one-dimensional ordinary differential equation

(5)

where and are constants. This can be in fact be solved exactly because it is a separable equation,

and we find that

Reza Katebi, EE908 54

(6)

where . (This can be checked by plugging (6) into (5)).

To view the exact solution in Matlab, we create a file called ``yexact.m'' with the following lines of

text:

function r = yexact(t,y0,K,s)

r = y0*exp(K*t) + s*(1 - exp(K*t));

Note that this function takes four arguments, the time t, the initial condition y0, and the constants K

and s from (5). Suppose that we want the solution for y0=100, K=1, and s=20. First, in Matlab we

type:

t = 0:0.01:5;

which creates a vector t = (0,0.01,0.02,...,4.98,4.99,5), then

plot(t,yexact(t,100,1,20))

which plots yexact vs. t at the times given in the vector t.

10.3 Numerically Solving the Example with Euler's Method

Although we know the exact solution for equation (5), it is instructive to consider its numerical

solution using Euler's method. This is implemented in Matlab with the following series of statements

(note that we compare to the exact solution, so to run this program you must have the file ``yexact.m''

as described on the last page):

% Example: Euler's method for dy/dt = K*(y-s)

K = 1;

s = 20;

y0 = 100;

npoints = 50;

dt = 0.1;

Reza Katebi, EE908 55

y = zeros(npoints,1); % this initializes the vector y to being all zeros

t = zeros(npoints,1);

y(1) = y0; % the initial condition

t(1) = 0.0;

for step=1:npoints-1 % loop over the timesteps

y(step+1) = y(step) + dt*K*(y(step)-s);

t(step+1) = t(step) + dt;

end

plot(t,y,'r'); %plots the numerical solution in red

hold on; %keep the previously plotted lines

plot(t,yexact(t,y0,K,s)); %plots the exact solution (default plot is in blue, solid line)

10.4 Conditional Statements

It is often of interest to determine when the solution satisfies a certain property. For example, suppose

that we want to know when the solution obtained with Euler's method to equation (5) with crosses.

This can be accomplished with the following Matlab program:

K = 1;

s = 20;

y0 = 100;

y=1000;

npoints = 50;

dt = 0.1;

y = zeros(npoints,1);

t = zeros(npoints,1);

y(1) = y0;

t(1) = 0.0;

for step=1:npoints-1

y(step+1) = y(step) + dt*K*(y(step)-s);

t(step+1) = t(step) + dt;

Reza Katebi, EE908 56

if ((y(step) < 1000) & (y(step+1) > 1000)) % conditional statement

fprintf('y crosses 1000 at t= %14.7f',t(step+1)); % output result to the screen

end

end

Exercise 10.5

The van der Pol equation is an ordinary differential equation that models self-

sustaining oscillations in which energy is fed into small oscillations and removed

from large oscillations. This equation arises in the study of circuits containing vacuum

tubes and is given by

˙ ˙ y + µ(1! y

2

) ˙ y + y = u

assume

x

1

= y

x

2

= ˙ y

(1) Write the state space model for the system.

(2) Use Euler method to simulate the system

(3) Plot

x

1

against x

2

for u=1, µ = 0.2 and u=1, µ = 1

- CableUploaded byFernandoMartínIranzo
- TE IndustrialUploaded byAbhishek Gawde
- 329-outline-2011Uploaded bybr3nt
- 8 Differential EquationsUploaded byqu001
- Higher-Order Finite Element Methods - Pavel SolinUploaded byPuru-the-brave
- Differential Equation Manual Ledder_SSMUploaded byHarold Quilang
- 1-s2.0-S1474667015365277-main.pdfUploaded byVignesh Ramakrishnan
- chpter 6 1Uploaded byNorizzatul Akmal
- Teaching Mathematics in Engineering Education Through TechnologyUploaded byEditor IJRITCC
- 18_032006L02Uploaded byIgor Campos
- Individual AssignmentUploaded byAcik SulieSol
- Cosmos 2006Uploaded byolasanyaa
- matlab tutorialUploaded byShahid Mehmood Naqi
- Sem 1Uploaded byJebin Abraham
- PHW#3Uploaded byHusein Bhinderwala
- 1-s2.0-0377042795001603-main.pdfUploaded byNacera Benslimane
- Economics Homework Sample problems with SolutionsUploaded byHebrew Johnson
- Chap01 IntroUploaded bynugrohoisnandi
- precalculusUploaded byapi-262822396
- CSE Proposed 3rd Year Syllabus 19.06.12Uploaded bysupernovadx
- l t 5 4 lesson planUploaded byapi-298949340
- ANOTHER INTEGER NUMBER ALGORITHM TO SOLVE LINEAR EQUATIONS (USING CONGRUENCY)Uploaded byDon Hass
- sdarticleUploaded byKannaboyina Sainath Yadav
- Stationary StatesUploaded byTian Lu
- Modified Finite Difference Schemes on Uniform Grids for Simulations of the Helmholtz Equation at Any Wave Number – Wajid Et Al - 2014Uploaded bysamouille6666
- c5Uploaded byAlexTayZhiXin
- nbsbulletinv12n4p583_A2bUploaded byanushka chadha
- LudkovskiThesisUploaded byHagop Kechejian
- Math CatalogUploaded byrrockel
- Simulation of VOC emissionsfrombuildingmaterialsbyusingthe state-spacemethodUploaded byskaler

- Tap ChartUploaded bydai83
- P3TFA22CAANUploaded bydai83
- Simple Cantilever TestUploaded bydai83
- Block DiagramUploaded bydai83
- SoutionUploaded bydai83
- MECH_4841_B_(3118662)Uploaded bydai83
- Euro-Divers Meeru English 12% GSTUploaded bydai83
- Motors and Pumps Control BasicUploaded bydai83
- 3D_CVM_CVM_1-208979-0_AEUploaded bydai83
- MICHELIN Guide Kyoto Osaka Kobe Nara 2013 Selection ListUploaded bydai83
- Wiring Circuits From SchematicsUploaded bydai83
- DG 9 english.pdfUploaded bydai83
- 1k 2k Finish on Stainless Steel Sheet and Plate Why is It So ImportantUploaded bydai83
- 28400_ENUploaded bydai83
- EMC Cable GlandsUploaded bydai83
- Tap ChartUploaded bydai83
- Sol_5_Ch16Uploaded bydai83
- Ironman lego manualUploaded bydai83
- E-5 System Chart en FR ESUploaded bydai83
- Wind Turbine FeedbackUploaded bydai83
- ÉñµñÏÀÂÂUploaded bydai83
- 神雕侠侣_第一部Uploaded bydai83
- Soution 4.8.2013Uploaded bydai83
- Problem 7+10Uploaded bydai83
- Gantt ChartUploaded bydai83
- Pneumatic ValvesUploaded bydai83
- FeedbackUploaded bydai83
- Simple Cantilever TestUploaded bydai83
- Feedbacks Out i OnUploaded bydai83