1Differential Equations9-28-20052Opening Discussion■What did we talk about last class?■Let's talk a bit about the first project.■What do you know about differential equations?3What are ODEs?■Ordinary differential equations are extremely common in science. The idea is that we have functions that tell us the derivatives of values instead of telling us the values themselves.■In a math class you learn various techniques to solve ODEs. The simplest ODEs can be solved simply by integrating them.■Numerically, we can approximate the function by “following the slope” since it is the slope that we are given.˙x1= f1t , x1,x2,... , xn˙x2= f2t , x1,x2,... , xn...˙xn= fnt , x1,x2,... , xn4ODEs in Matlab■Matlab has a number of build in ODE solvers. All of these deal with systems of linear ODEs. That means that we have a set of equations of the form where the first derivative of a value is equal to some function.■In general, any ODE of any order (those involving higher derivatives) can be converted to a system of first order ODEs by using variables to represent the higher order derivatives.■Unless you have a reason to use something else, you will typically solve your ODEs with the ode45 function. This function uses a 4th to 5th order Runga-Kutta method.5Euler's Method■Just to help you see how we solve differential equations on a computer, we should look at Euler's method. This is a first order method that you shouldn't use unless you have nothing better to use. It has the advantage of being simple and fast.■Given the system of equations mentioned before, Euler's method would say the x values are as follows.x1tt =x1t t∗ f1t , x1,x2,... , xnx2tt =x2t t∗ f2t , x1,x2,... , xn...xntt =xnt t∗ fnt , x1,x2,... , xn6Using the ode Functions■In order to use ode45 of other ODE solving functions, we must define our function in an m-file because we want to pass a handle to it into the ode function. This function should return the derivatives as a column vector.■If we don't use any return values the function will simply show a plot. A single return value returns a structure. Having two return values gives us the times as well as the arrays of values at each time. That can then be plotted as we see fit.7Examples■ODEs abound in physics. The simplest ones involve solving the paths of particles interacting through a force like gravity or having masses on springs.■Population biology can also be expressed as differential equations. Consider things like predator-prey models where how quickly a population changes depends on how much food it has, how many there are now, and how many predators there are.8Reminders■You don't have anything due until next
View Full Document