CS310 Team Lab #14
Numeric Solutions to Ordinary Differential Equations
OBJECTIVES
- Understand what a numeric solution to an ODE looks like in MATLAB.
- Learn the correct form of a right-hand side ODE function that ode45 can use to numerically solve an ODE.
- Gain experience plotting numeric solutions to an ODE in MATLAB.
- Learn how to convert a second order ODE into a system of first order ODEs.
- Learn how to use ode45 to solve systems of first order ODEs.
INTRODUCTION
Solving ODEs numerically in MATLAB uses the ode45 command, which takes a function handle as one of its arguments.
Just like for fzero and integral, there are two parts to solving an ODE using ode45:
- define a function that computes something, in this case, the value of the derivative and
- write a script (or code) that sets up and calls the function, in this case ode45(), with a function handle for the function you defined.
In this team lab, you will get experience solving ordinary differential equations numerically in MATLAB and plotting their solutions.