 University of Tennessee Department of Chemical Engineering

ChE 505 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.)

 algebraic equations single equation linear no software necessary non-linear rootfinder.m contained in AE505.zip includes solutions by Newton-Raphson method with numerical derivatives line minimization of Brent method without derivatives line minimization of Brent method with numerical derivatives MATLAB "fzero" function systems of equations linear syslineqn_ex.m contained in AE505.zip includes an example problem using MATLAB instrinsic linear algebra routines linalg_v2.m contained in lin_alg.zip includes a short file which examines the system Ax=b for existence and uniqueness of solutions. Case 1. Reports unique solutions when rank(A) = n. Case 2. Reports one example of infinite solutions when rank(A) = n-1. Case 3. Reports there are infinite solutions when rank(A) < n-1. Case 4. Reports there are no solutions when rank(A) < rank(A|b). non-linear syseqn.m contained in AE505.zip includes solutions by Newton-Raphson method with numerical derivatives Nelder and Mead's Downhill Simplex method Powell's Direction Set method Polak and Ribiere's Conjugate Gradient method (with numerical derivatives) MATLAB "fsolve" function syseqninput_*.m contained in AE505.zip includes example problems: syseqninput_hx12.m: cross-over in a 1-2 Heat Exchanger syseqninput_chemeq_NH3.m: chemical eqlbm of an adiabatic N2, H2, NH3 system syseqninput_VLEpure.m: single component vapor-liquid eqlbm of O2 (van der Waals or Peng-Robinson EOS) syseqninput_extractor.m: liquid-liquid extractor steady-state material balances syseqninput_CSTR.m: adiabatic or isothermal CSTR steady-state material and energy balances compare_syseqn.m contained in AE505.zip includes comparison of results of 5 solution techniques of syseqn.m comparison of computation times of 5 solution techniques of syseqn.m ordinary differential equations single equation linear syslinode.m contained in ODE505.zip includes solutions by eigenanalysis using MATLAB intrinsic linear algebra routines non-linear sysode.m contained in ODE505.zip includes solutions by Euler Method Classical Fourth order Runge-Kutta Method systems of equations linear syslinode.m contained in ODE505.zip includes solutions by eigenanalysis using MATLAB intrinsic linear algebra routines non-linear sysode.m contained in ODE505.zip includes solutions by Euler Method Classical Fourth order Runge-Kutta Method sysodeinput_*.m contained in ODE505.zip includes example problems: sysodeinput_CO2.m: 1-D dynamic vibrational & translational motion of CO2 sysodeinput_CSTR.m: adiabatic or isothermal CSTR transient material and energy balances shooting.m contained in ODE505.zip includes solutions to ODE Boundary Value Problems Shooting Method via the Euler Method Shooting Method via the Classical Fourth order Runge-Kutta Method partial differential equations single equation parabolic file.m contained in PDE505.zip includes solutions by method hyperbolic file.m contained in PDE505.zip includes solutions by method elliptic file.m contained in PDE505.zip includes solutions by method systems of equations parabolic file.m contained in PDE505.zip includes solutions by method hyperbolic file.m contained in PDE505.zip includes solutions by method elliptic file.m contained in PDE505.zip includes solutions by method integral equations single equation one-dimensional integral integrate.m contained in IE505.zip includes solutions by Trapezoidal rule Simpson's 1/3 rule MATLAB quad routine multidimensional integral integraten.m contained in IE505.zip includes solutions by multidimensional Simpson's 1/3 rule Monte Carlo (not posted) systems of equations one or multi- dimensional integral file.m contained in IE505.zip includes solutions by method sysodeinput_*.m contained in IE505.zip includes example problems: syseqninput_VLE_equalarea.m: description fstatistic.m: description pvalue.m: description systems of mixed equations systems of equations linear or non-linear file.m contained in MSE505.zip includes solutions by method sysodeinput_*.m contained in MSE505.zip includes example problems: sysodeinput_prob.m: description

back to ChE 505 Main Page
Contact:  Instructor