Last | Top | Next

Differential Equations (92.236)
Listing of Matlab Demos

This page contains a summary list of the Matlab demos available for this course. The list is organized roughly by subject and by the order that the files are discussed. These files will be used in the Matlab lab sessions and they can also be used as a guide for many of the Matlab assignments given throughout the semester. Quite often, only minor modifications to these demos are needed to solve similar HW problems. Careful study of these sample problems should make the Matlab assignments quite straightforward and also give you a solid understanding of various problem solving strategies and techniques within Matlab.

You can view a particular Matlab file or download it by simply clicking the right mouse button on the link over the file name. From here you can either choose "open in new window" to view the file online or "save target as" to download the file directly to your PC (note that these commands might differ slightly depending on your choice of web browser). In any case, once the file is on your machine, you can run it just like any other Matlab script file. Good Luck and enjoy!!!

Introduction to Matlab
Introduction to some basic Matlab plotting capabilities and syntax.
Evaluate and plot analytical expressions in a number of different ways. This file is a good starting point for the plots requested as part of HW #2.
Evaluate and plot analytical solutions to a particular IVP treated in class.
Evaluate and plot multiple curves on a single axis. This Matlab file gives an example that produces plots that are very similar to the curves requested as part of one of the problems for HW#5.
This demo represents a collection of short examples that illustrate several Matlab programming features and general tips. It is used as part of one of the Matlab lab sessions.
These two files are needed for one of the Matlab lab sessions. They will be used to illustrate various analysis and plotting techniques for 2nd order systems.

Slope Fields
Capability and illustrations for generating slope fields.
A Matlab function file that plots a slope field for a 1st order ODE (uses Matlab's quiver function).
Plot slope field and solution curves for demonstration problem from the text. These files require function file sfield.m.
This is similar to SF_DEMO1 but it only plots the slope field (no solution curves). This demo is a good starting point for the Matlab plots requested as part of HW #4. These files require function file sfield.m.
These three separate demos plot the slope field and solution curves for three different first order systems. They simply provide additional examples similar to the SF_DEMO1 and SF_DEMO2 sequence. These files also require the sfield.m function.

Numerical Methods
Capability and demos for numerical solution of IVPs.
Function files to implement different numerical solution schemes for first order ODEs. These files implement the Euler, Improved Euler, and 4th Order Runge Kutta Methods, respectively. These function files must be called from a main program.
Sample program to illustrate the Euler Method. The example differential equation is contained in function file eqn1.m.
Sample program to illustrate the Improved Euler Method. The example differential equation is contained in function file eqn1.m.

Sample program to illustrate the 4th Order Runge Kutta Method (RK4 Method). The example differential equation is contained in function file eqn1.m.
Sample program to illustrate four different numerical solution techniques including the Euler, Improved Euler, and RK4 Methods as well as Matlab's built-in ode23 function. ode23 uses an adaptive step control method so that, instead of the step size, one specifies the desired tolerance for the problem. The example differential equation is contained in function file eqn1.m.
Interactive Numerical solution of ODEs. This M-file solves an IVP using one of four numerical integration schemes -- Euler, Improved Euler, 4th Order RK, or the adaptive predictor-corrector method within Matlab. The function file containing the definition of f(x,y) is selected interactively or the user can type in the function f(x,y). The second option calls a generic function file, sfode.m, which evaluates the function f(x,y) input via the keyboard.
Numerical Solution of ODEs using a variety of methods. This M-file solves the given IVP using a full selection of numerical integration schemes -- Euler, Improved Euler, 4th Order RK, and the adaptive predictor-corrector method within Matlab. The solution vectors are plotted together to demonstrate the accuracy obtained with the different methods. The function file containing the function definition is selected interactively.
Plot solution for P(t) for HW9_DEMO1. This example uses Matlab's ode23 routine to solve a simple population model.
Plot solution for x(t) and v(t) for HW9_DEMO3. This example uses Matlab's ode23 routine with two ODEs with two dependent variables, x(t) and y(t). It uses a simple vector notation. This is our first example of a system of ODEs.

Some Applications
Demos with numerical applications requiring two equations.
Generates solution curves for HW14_DEMO1. These files use Matlab's built-in ODE solver to numerically integrate a system of two first-order ODEs. Comparison to the analytical solution is given. The symbolic solution using Matlab's dsolve command is also generated.
Generates solution curves for HW14_DEMO2. These files use Matlab's built-in ODE solver to numerically integrate a system of two first-order ODEs. Comparison to the analytical solution is given. The symbolic solution using Matlab's dsolve command is also generated.

Laplace Transforms
Demos for taking Laplace and inverse Laplace transforms.
Demo which illustrates how to take Laplace transforms using the Matlab function LAPLACE from the Symbolic Toolbox.
Demo which illustrates how to take inverse Laplace transforms using the Matlab function ILAPLACE from the Symbolic Toolbox.

Additional detailed modeling and simulation applications are also available for First Order Systems and for Second Order Linear and Nonlinear Systems. These cases focus on the development and solution of the resultant differential equations. They offer, in some cases, significant additional insight into the problem formulation and systematic arguments that lead to the desired solution. Some of these applications also offer additional Matlab implementations and the links to these application-oriented Matlab files are given in the following tables:

Applications involving First Order Systems
Demos from the Lecture Notes on First Order Systems.

Matlab file for the Bombs Away application.

Matlab files for the Two Salty Tanks application.
Matlab files for the application, A Fish Story.

Last updated by Prof. John R. White (Feb. 2007)

Last | Top | Next

 
 
Main | Current Activities | Courses | Research | Vitae | Misc. Goodies