0% found this document useful (0 votes)
40 views

Lab Session #7-4

Uploaded by

arda2207ozturk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

Lab Session #7-4

Uploaded by

arda2207ozturk
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Ordinary Differential Equations

ME 303 - Computer Applic tions in Mech nic l Engineering


L b Session #7

November 18 - 20, 2024


a
a
a
a
Ordinary Differential Equations (ODEs)
De nition: Di erential equations (DEs) with a single independent variable.
(N−1) (N)
f(t, y, y′, y′′, ⋯, y )=y
System of ODEs: Higher order DEs are turned into a set of rst order di erential
equations
y f1(t, y, y′, y′′, ⋯, y ) (N−1)

y′ f2(t, y, y′, y′′, ⋯, y (N−1)


)
y= ⋮ =

(N)
y f(t, y, y′, y′′, ⋯, y (N−1)
)



Generally, DEs are solved using numerical methods, as exact solutions become
complicated.










fi
ff
fi
ff
Numerical Approach (1st Order)
First Order DEs:
1. Discretize your domain into it’s sections

2. Impose initial condition (y(0) = y0) to


your function

3. Estimate y1 using selected method


4. Iterate over entire domain
Higher Order DEs:
1. Convert equation into system of rst
order DEs
2. Solve entire system step-by-step
fi
Euler’s Method
Simplest method for solving ODEs

yn+1 = yn + hf(tn, yn)


Can be derived from:
1. Taylor’s theorem where higher order derivatives
are ignored
2. Reordering of numerical di erentiation formula
Easily implemented, but can be unstable for sti
equations and has low accuracy at high step sizes
Examples:
t 4e t−4
y′ = 4e y with y(0) = 5 → y(t) = 5e
−5x
y′ = − 5y with y(0) = 1 → y(x) = e


ff
ff
Heun’s Method
yi+1 is rst predicted with Euler’s method,
and then corrected with trapezoid method
Also called improved Euler’s method
h
yi+1 = yi + ( f(ti, yi) + f(ti+1, y*
i+1
))
2
where y*
i+1
is calculated using Euler’s
method at ti
More accurate than Euler’s method, but
requires additional computations
fi
Runge-Kutta Method
Approximation of Taylor series of order N = 4
h(k1 + 2k2 + 2k3 + k4)
yi+1 = yi +
6
k1 = f(ti, yi)

( 2)
h k1
k2 = f ti + , yi + h
2

( 2)
h k2
k3 = f ti + , yi + h
2
k4 = f(ti + h, yi + hk3)
ode45(f, t_span, y_init):
Built-in MATLAB function for solving ODEs

You might also like