Lecture40

# Lecture40 - System of ODEs ❚ A system of simultaneous...

This preview shows pages 1–9. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: System of ODEs ❚ A system of simultaneous ODEs ❚ n equations with n initial conditions = = = ) , , , , ( ) , , , , ( ) , , , , ( n 2 1 n n n 2 1 2 2 n 2 1 1 1 y y y t f dt dy y y y t f dt dy y y y t f dt dy System of ODEs ❚ Bungee Jumper’s velocity and position ❚ Two simultaneous ODEs v x v m c g dt dv v dt dx 2 d = = - = = ) ( ) ( = = t m gc c m t x t m gc c gm t v d d d d cosh ln ) ( tanh ) ( Solution: Second-Order ODE ❚ Convert to two first-order ODEs = = = 1 2 2 ) (t dt dy t y dt dy y t g dt y d α α , ) ( ) , , ( = = = = = = ⇒ = = 1 2 1 2 1 2 2 2 2 1 2 1 t y t y s C I y y t g dt y d dt dy y dt dy dt dy dt dy y y y let α α ) ( ) ( . . ) , , ( System of Two first-order ODEs Euler’s Method ❚ Any method considered earlier can be used ❚ Euler’s method for two ODE-IVPs ❚ Basic Euler method ❚ Two ODE-IVPs y y t hf y y y y t hf y y i 2 i 1 i 2 i 2 1 i 2 i 2 i 1 i 1 i 1 1 i 1 + = + = + + ) , , ( ) , , ( , , , , , , , , ) , ( i i i 1 i y t hf y y + = + y 1 y 2 y 3 1 2 t Hand Calculations: Euler’s Method ❚ Solve the following ODE from t = 0 to t = 1 with h = 0.5 ❚ Euler method [ ] [ ] [ ] 1, 1 1, 1 1, 2, 1, 1, 2, 1 2, 2 1, 2, 2, 1, 2, 1 1 1 2 2 1 2 ( , , ) (0.5 ) ( , , ) (4 0.1 0.3 ) y (0.5) y (0) 0.5y (0) 4 ( 0.5)(4) (0.5) 3 y (0.5) y (0) 4 0.1y (0) 0.3 (0) 6 4 0.1(4) 0. i i i i i i i i i i i i i i i y y f t y y h y y h y y f t y y h y y y h h y h + + = + =- = + = +-- = +- = +- = = +-- = +-- [ ] [ ] [ ] [ ] [ ] 1 1 1 2 2 1 2 3(6) (0.5) 6.9 y (1.0) y (0.5) 0.5y (0.5) 3 ( 0.5)(3) (0.5) 2.25 y (1.0) y (0.5) 4 0.1y (0.5) 0.3y (0.5) 6.9 4 0.1(3) 0.3(6.9) (0.5) 7.715 h h = = +- = +- = = +-- = +-- = = = -- =- = 6 y 4 y y 3 y 1 4 dt dy y 5 dt dy 2 1 2 1 2 1 1 ) ( ) ( . . . Euler’s Method for a System of ODEs y is a column vector with n variables function f = example5(t,y) % dy1/dt = f1 = -0.5 y1 % dy2/dt = f2 = 4 - 0.1*y1 - 0.3*y2 % let y(1) = y1, y(2) = y2 % tspan = [0 1] % initial conditions y0 = [4, 6] f1 = -0.5*y(1); f2 = 4 - 0.1*y(1) - 0.3*y(2); f = [f1, f2]'; Euler Method for a System of ODEs >> [t,y]=Euler_sys('example5',[0 1],[4 6],0.5); t y1 y2 y3 ... 0.000 4.0000000000 6.0000000000 0.500 3.0000000000 6.9000000000 1.000 2.2500000000 7.7150000000 >> [t,y]=Euler_sys('example5',[0 1],[4 6],0.2); t y1 y2 y3 ... 0.000 4.0000000000 6.0000000000 0.200 3.6000000000 6.3600000000 0.400 3.2400000000 6.7064000000 0.600 2.9160000000 7.0392160000 0.800 2.6244000000 7.3585430400 1.000 2.3619600000 7.6645424576 (h = 0.5) (h = 0.2) Euler Method for Second-Order ODE function f = pendulum(t,y) % nonlinear pendulum d^2y/dt^2 + 0.3dy/dt = -sin(y)d^2y/dt^2 + 0....
View Full Document

## This note was uploaded on 09/05/2011 for the course EGM 3344 taught by Professor Raphaelhaftka during the Spring '09 term at University of Florida.

### Page1 / 53

Lecture40 - System of ODEs ❚ A system of simultaneous...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online