Ordinary Differential Equations (ODEs) Background Video 17 Daniel J. Bodony Department of Aerospace Engineering University of Illinois at Urbana-Champaign
In this video you will learn... 1 What ODEs are 2 Matlab and ODEs: first order form D. J. Bodony (UIUC) AE199 IAC Video 17 2 / 9
What ODEs Are Let s introduce ODEs by way of a familiar example: a ballistic trajectory. Consider this picture of a sphere of mass m leaving a planar surface with initial speed v 0 and an angle θ 0 from the x-axis: How do you find the trajectory? You apply Newton s 2nd Law F = m a on the sphere to get ma x = 0 ma y = mg. D. J. Bodony (UIUC) AE199 IAC Video 17 3 / 9
What ODEs Are From the definition of acceleration we know that the velocity v and acceleration are related via d v dt = a and the position x(t) of the sphere is also given by Putting all of these together yields d x dt = v. m d2 x dt 2 = 0 m d2 y dt 2 = mg. D. J. Bodony (UIUC) AE199 IAC Video 17 4 / 9
What ODEs Are Assuming g is a constant, we can integrate these two equations to get x(t) = x 0 + v 0 t cos θ 0 y(t) = y 0 + v 0 t sin θ 0 gt2 2 for the trajectory x(t) = (x(t), y(t)) of the sphere. D. J. Bodony (UIUC) AE199 IAC Video 17 5 / 9
What ODEs Are Assuming g is a constant, we can integrate these two equations to get x(t) = x 0 + v 0 t cos θ 0 y(t) = y 0 + v 0 t sin θ 0 gt2 2 for the trajectory x(t) = (x(t), y(t)) of the sphere. So what? Well, go back to the equations m d2 x dt 2 = 0 m d2 y dt 2 = mg from the previous slide. Notice they are of the form {some derivative of at least one function} = {another function} This is precisely what we mean by an ordinary differential equation. D. J. Bodony (UIUC) AE199 IAC Video 17 5 / 9
What ODEs Are Going back to Newton s 2nd Law, we are free to write it as (for a constant mass m) d 2 x dt 2 = F m as an ODE for the trajectory x(t) as a function of the applied forces F and mass m. D. J. Bodony (UIUC) AE199 IAC Video 17 6 / 9
What ODEs Are Going back to Newton s 2nd Law, we are free to write it as (for a constant mass m) d 2 x dt 2 = F m as an ODE for the trajectory x(t) as a function of the applied forces F and mass m. When we found the solution for the trajectory of the sphere of mass m, we used two other ODEs d v dt = a d x dt = v. So, in reality, you already know a lot about ODEs. D. J. Bodony (UIUC) AE199 IAC Video 17 6 / 9
Matlab and ODEs: first order form Matlab has several functions that integrate ODEs for you, even the ones you can t do by hand. There s a catch, though: you have to write the ODEs in first order form which means that the equations must look like this {first derivative of one function} = {another function}. In terms of our trajectory example this means the ODE must be written as instead of as d v dt = F m d x = v. }{{} dt first deriv. d 2 x F }{{} dt 2 = m. second deriv. D. J. Bodony (UIUC) AE199 IAC Video 17 7 / 9
Matlab and ODEs: first order form Matlab generically refers to the ODE as d y dt = y = f (t, y) where f is known as the right-hand-side function. 1 You ll learn much more about it in AE370. D. J. Bodony (UIUC) AE199 IAC Video 17 8 / 9
Matlab and ODEs: first order form Matlab generically refers to the ODE as d y dt = y = f (t, y) where f is known as the right-hand-side function. The most heavily used ODE integrator in Matlab is ode45. There is lots of details about what ode45 is, how it works, when it fails, etc.; however, the only you thing you need to know is how to use it. 1 1 You ll learn much more about it in AE370. D. J. Bodony (UIUC) AE199 IAC Video 17 8 / 9
Matlab and ODEs: first order form The ode45 function call looks like this: where [time, out] = ode45(@fun, tspan, ic); time out @fun tspan ic = column vector of time = matrix of the solution (more later on this) = function handle of f (t, y) = row vector of [t 0, t f ], the initial and final times = row vector of initial conditions D. J. Bodony (UIUC) AE199 IAC Video 17 9 / 9
Matlab and ODEs: first order form The ode45 function call looks like this: where [time, out] = ode45(@fun, tspan, ic); time out @fun tspan ic = column vector of time = matrix of the solution (more later on this) = function handle of f (t, y) = row vector of [t 0, t f ], the initial and final times = row vector of initial conditions In the next video we ll do some examples. D. J. Bodony (UIUC) AE199 IAC Video 17 9 / 9