University of Tennessee
Department of Chemical Engineering

ChE 301 Library of MATLAB® Subroutines

I am a strong believer in learning by example, especially in programming. If you have an elementary program that shows the syntax for doing a job A and another elementary program that shows the syntax for doing a job B, then you have everything you need to know to write a program to do both A and B.

That is the philosophy behind providing these codes, rather than making you write them from scratch. I have written some basic subroutines (MATLAB® *.m files) and I expect you to use this library of subroutines to accomplish tasks more complicated than those explicitly done in the subroutines themselves.

Given the rapid rate at which new programs, software, and hardware are being developed, it is often the case that no manual or instruction exists. What one has to rely on is a few paltry examples posted on the web by other hardy souls braving the perils of novel and untested systems.

So, this course encourages you to use the examples available and requires you to be able to read, understand, and modify the code to suit your own purpose.

(These codes have been zipped with WinZip®.
You must unzip them and move them to your current working MATLAB directory in order to use them.)
  • Ordinary Differential Equation Solver
    • single first order ODE IVP using Euler and Runge-Kutta routines
    • n-equation system of first-order ODE IVP's using Euler and Runge-Kutta routines
    • shooting method (using Euler or RK4) for nth-order ODE BVP's

  • Regression Routines
    • simple regression (single-variable linear regression)
    • n-variable linear regression
    • nth-order single-variable polynomial regression (e.g. cubic spline)
    • confidence intervals (new feature, added 4/20/99)

  • Integration Routines
    • Numerical Integration using the Trapezoidal Rule
    • Numerical Integration using Simpson's 1/3 Rule
    • Numerical Integration using Gaussian Quadrature

  • Systems of Nonlinear Algebraic Equations Solver
    • n-equation system of non-linear algebraic equantions solver
    • An example of solving a system of nonlinear equations:  the material balance on an extractor with 2 components in the feed, solvent, extract, and raffinate streams.

  • Chemical Equilibria Example Code
    • an input file for syseqn.m
    • An example of solving a system of nonlinear equations:  chemical equilibria of the ethylene, benzene, ethyl-benzene system under isothermal or adiabatic conditions.

  • ANOVA Routines
    • 2-factor ANOVA
    • 2k factorial experiment
    • computer look-up of t-statistics table for confidence intervals
    • computer look-up of f-statistics table for hypothesis testing

back to ChE 301 Main Page
Contact:  Instructor