MATLAB Tutorial

Computer Methods in Chemical Engineering


Table of Contents


Introduction

MATLAB stands for MATrix Laboratory. It was originally developed as a user interface to call some FORTRAN matrix routines that were originally developed by the National Labs and were freely available in the public domain... Blah, Blah, Blah... Not another tutorial! Since there are already an abundance of tutorials on the internet -- it seems that every user has written one if not a full blown book, I will simply provide you with a few pointers.


Getting Started at College Park

You can access MATLAB from both UNIX computers and PCs.

Steps for Unix computers

To access from a UNIX computer, do the following:

  1. unix: tap matlab (for v5.3) or tap oldmatlab (for v4.2)
  2. unix: matlab
The first step runs a command file for you to set up the search path, etc. The second step loads the matlab program. The programs and .M files are located in "/afs/glue.umd.edu/software/matlab50" Look for .M files in the "toolbox" subdirectory. If you telnet to a Unix computer, rather than using a Unix workstation, it is likely that your telnet program is a text-based program. Be warned that you will not be able to plot anything from a text-based telnet connection. If you want to do plotting, use a graphics-based telnet program such as X-Win. You will find an X-Win icon in most of the PCs in College of Engineering's Computer Labs.

Steps for Windows NT Machines in Engineering Computer Lab

To access version 5.3: |Start|Programs|Matlab|

Steps for Windows NT Machines in Chemical Engineering Computer Lab

To access Student version 5.0 from some machines that have Matlab program loaded locally: |Start|Programs|Student Matlab|Student Matlab|.
To access version 5.3 from some machines that you do not find under |Start|Programs|Student Matlab|, follow the following steps.

  1. Get a copy of SETUPCHE.BAT (Skip this step if you already have one.)
    Run SETUPCHE.BAT. The Matlab icon should be on the Windows desktop.
  2. Click on the Matlab icon to run from Windows or issue "matlab" to run from ench250 DOS prompt. However, be warned that since the program is pulled from the reynolds server, it will take some time to load.

Steps for Windows NT Machines in PG2 Open Lab

  1. Get a copy of SETUPPG2.BAT (Skip this step if you already have one.)
    Run SETUPPG2.BAT. The Matlab icon should be on the Windows desktop.
  2. Click on the Matlab icon to run from Windows or issue "matlab" to run from ench250 DOS prompt. However, be warned that since the program is pulled from the reynolds server, it will take some time to load.


Mathworks (Maker of MATLAB)

Mathworks Home Page has information on: Mathworks' Anonymous Ftp Site at "ftp.mathworks.com" has:


MATLAB Primer

A "Classic" MATLAB Primer (Third Edition for MATLAB v4; 35 pages) written by Prof. Kermit Sigmon of the Department of Mathematics at the University of Florida. The primer (Third Edition) was freely available a while ago from many ftp sites, but no more. He has since developed it into a full book (Fifth Edition), and he wants you to buy it from CRC Press (approx. $16.95). Before the proliferation of on-line tutorials (see below), this primer had been a very useful document for many poor students who could not afford the MATLAB books. If you do not know TeX, simply download the postscript file and send it to a postscript printer. (Most of the laser printers on campus are postscript printers.) The older Second Edition (for MATLAB v3.5; 25 pages) is still available from the University of Florida, Mathworks' ftp site, or locally from UMCP (to avoid internet traffic).

HTML Format

I have ported the MATLAB Primer (Second Edition) to the HTML format suitable for viewing with a web browser. The following is a table of contents. More information on the Fifth Edition


Tutorials

You can find many on-line tutorials on MATLAB on the internet. Listed below are some of them. These are second-hand documentations. Tutorials are meant to get you started, far from being complete. (For completeness, look to the next section.) Thus, topics missed in some will be picked up in others. The extent of coverage presented in the following first two links is suitable for ENCH250.


User's Manuals and Reference Manuals

This section lists the "real" first-hand documentation for MATLAB. A heavy-duty MATLAB programmer will find these documents indispensable, but a novice will find them a bit overwhelming. The following PDF documentation files (viewed and printed with Adobe Acrobat). are very comprehensive and extremely volumous -- thousands of pages. The two most useful ones for a beginner are Getting Started with MATLAB and Using MATLAB. Note that the following are documentations for MATLAB v5.3. There are some differences between different versions -- not much in what we do in ENCH250, but enough to frustrate a beginner thoroughly.

File Name Size (Bytes)
Pages
Title & Description
Core MATLAB Reference Manuals
relnotes.pdf 349KB
67 pages
Release Notes for the MATLAB 5.3 Product Family
Release notes for MATLAB, Simulink, Stateflow and other products in the 5.3 release.
newfeat.pdf 1,128KB
142 pages
MATLAB 5.3 New Features
How MATLAB v5.3 differs from v4.x.
getstart.pdf 874KB
99 pages
Getting Started with MATLAB
Fundamentals of MATLAB.
using_ml.pdf 4,051KB
513 pages
Using MATLAB
The "Bible" of the MATLAB language.
refbook.pdf 5,565KB
772 pages
Language Reference Manual
Reference descriptions for MATLAB's commands, functions, and operators (except those related to graphics).
graphg.pdf 8,925KB
364 pages
Using MATLAB Graphics
How to use MATLAB's graphics and visualization tools.
gref.pdf 4,894KB
446 pages
Graphics Reference Manual
Reference descriptions for MATLAB's graphics functions.
buildgui.pdf 1,217KB
88 pages
Building GUIs with MATLAB
How to make MATLAB-based Graphical User Interface tools.
apiguide.pdf 842KB
179 pages
MATLAB Application Program Interface Guide
How to write C or Fortran programs to interact with MATLAB.
apiref.pdf 2,063KB
362 pages
MATLAB Application Program Interface Reference Manual
Reference descriptions for the API routines to enable C or Fortran programs to interact with MATLAB.
notebook.pdf 360KB
67 pages
MATLAB Notebook User's Guide
Access MATLAB from within Microsoft Word.
ins_pcmc.pdf 328KB
45 pages
MATLAB Installation Guide for MS-Windows and Macintosh
How to install MATLAB on PC and Macintosh.
MATLAB Toolbox Reference Manuals
control.pdf 2,989KB
452 pages
Control System Toolbox User's Guide
dsp_blks.pdf 2,867KB
330 pages
DSP Blockset User's Guide
comm.pdf 5,088KB
718 pages
Communication Toolbox User's Guide
fp_blks.pdf 649KB
110 pages
Fixed-Point Blockset User's Guide
fuzzy.pdf 1,588KB
208 pages
Fuzzy Logic Toolbox User's Guide
images.pdf 5,481KB
380 pages
Image Processing Toolbox User's Guide
ncd_blks.pdf 642KB
106 pages
NCD Blockset User's Guide
optim.pdf 1,028KB
22 pages
Optimization Toolbox User's Guide
ode_suit.pdf 479KB
170 pages
MATLAB ODE Suite (a paper)
rtw_ug.pdf 1,648KB
244 pages
Real-Time Workshop User's Guide
signal.pdf 3,145KB
632 pages
Signal Processing Toolbox User's Guide
sl_nfg.pdf 354KB
62 pages
Simulink 2 New Features
sl_using.pdf 4,096KB
516 pages
Using Simulink
sf_ug.pdf 3,703KB
477 pages
Stateflow User's Guide
stats.pdf 1,994KB
388 pages
Statistics Toolbox User's Guide
symbolic.pdf 1,300KB
280 pages
Symbolic Math Toolbox User's Guide
tlc_ref.pdf 1,356KB
282 pages
Target Language Compiler Reference Guide
wavelet.pdf 10,558KB
626 pages
Wavelet Toolbox User's Guide

The most commonly accessed manuals are available directly from Mathworks.


On-Line References

The following links are on-line help on various MATLAB functions. You may want to browse through them and use the browser's "Find" to locate the function that may perform a required task. If you are using Windows' version, there is no need to retrieve help from the internet as you can simply click "Help" on the menu bar.


FAQs (Frequently Asked Questions and Links


Specialized MATLAB Application Series


MathViews -- A MATLAB-Compatible Program


A Word of Warning

As opposed to FORTRAN and other truly generally accepted high-level computer languages, which are invariably supported by multiple compiler vendors, MATLAB is the product of a single vendor, namely Mathworks. Not too many vendors survive the test of time over a long haul -- no matter how successful they appear at the time. The product is constantly evolving, which represents both progress and immaturity. The current version of MATLAB is 5.3. My experience tells me that there are enough changes among different versions that the files written with an older version do not necessarily run in a newer version without some very frustrating modifications. One immediate consequence of incompatibility among different versions is that the toolboxes are not transportable across different versions. For each version of MATLAB, MEX files have to be recompiled with FORTRAN or C compilers from very specific, version-dependent vendors. It is likely that you will be forced to change your FORTRAN or C compilers as you upgrade your MATLAB program. Naturally, the MEX files, too, are not transportable across different versions. Some very important mathematical commands and functions are revised in the name of progress and enhancement. And they are not even backward-compatible! There are many things I personally dislike. One example is the withdrawal of some routines (e.g., fsolve for solving algebraic equations). Instead of taking the time to correct its prior mistakes and blunders and instead of replacing the ill-behaved routines with better ones, Mathworks simply eliminated these routines from the standard package and threw them into a toolbox (and charge you extra for the toolboxes!) -- easy for Mathworks but tough for the users. And I will spare you the rest, as I am trying to convey to you positively what MATLAB can do. Well, I need to get back to clean up the mess Mathworks has created for me, lest you guys think my MATLAB programs don't run because I am a lousy programmer.


Return to Prof. Nam Sun Wang's Home Page
Return to Computer Methods in Chemical Engineering (ENCH250)

Computer Methods in Chemical Engineering -- MATLAB
Forward comments to:
Nam Sun Wang
Department of Chemical & Biomolecular Engineering
University of Maryland
College Park, MD 20742-2111
301-405-1910 (voice)
301-314-9126 (FAX)
e-mail: nsw@umd.edu ©1996-2006 by Nam Sun Wang
UMCP logo