math245lab05

math245lab05 - Math245 Computer Lab set #5, Fall 2008...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Math245 Computer Lab set #5, Fall 2008 Simulate the 2nd-order ODE by using Matlab All existing ODE solvers ( ode45 , etc.) are primarily designed to simulate the system of the 1st order ODEs, not the 2nd or higher order ODEs. Therefore, to simulate the 2nd-order ODEs, we need to setup the problem by rewriting the equation into a system of 1st order ODEs. Then we can simulate the set of 1st order ODEs by using ode45 in Matlab. Example Consider the initial value problem of the 2nd-order ODE y 00 + 1 4 y 0 + 2 y = 0 , y (0) = 0 , y 0 (0) = 2 . (1) (a) Simulate this initial value problem numerically for 0 t 30, and plot y ( t ) and y 0 ( t ). (b) Graph a phase plot y 0 ( t ) vs y ( t ). Preliminary formulation To set up the problem, we rewrite the equation into a system of 1st order ODEs by following steps. Step #1: Let’s denote y = y 1 , y 0 = y 2 . (2) Then from these equation we get y 0 1 = y 2 . (3) Step #2: Let’s rewrite our 2nd-order ODE by using y 1 and y 2 . (i.e., we rewrite y 00 y 0 2 , y 0 y 2 and y y 1 in the equation.) y 0 2 + 1 4 y 2 + 2 y 1 = 0 . (4) Step #3: Let’s collect 1st-order ODEs ((3) and (4)) and write in the form y 0 = f ( t, y ). y
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 4

math245lab05 - Math245 Computer Lab set #5, Fall 2008...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online