Академический Документы
Профессиональный Документы
Культура Документы
3 November 2009
Instructor: Andy Newman
Office Hours: Stop by room 306 (main
building) whenever
Email: anewman@atmos.colostate.edu
Website:
www.atmos.colostate.edu/programming
Syllabus
Week 1 (11/03)
Introduction to MATLAB
GUI
Variables, operations, built in functions
Help
Script Files
Week 2 (11/10)
Programming
Syntax
Arrays: Numeric, cell, structure
Strings
Built in functions (i.e. find, mean, max, min, sum, etc)
File I/O (text, binary, netCDF, HDF)
Basic program organization
Debugging
Syllabus
Week 3 (11/17)
Graphics
Line, scatter, bar, surface, contour plots, etc
Figure properties (i.e. Axis labels, tick marks)
Colormaps
Saving your plots
Images in MATLAB
Week 4 (12/01)
Somewhat more advanced topics
Making functions
Vectorized code
3-D plots
Data manipulation in MATLAB: regression, derivatives, others you
want
MATLAB Central File Exchange
Syllabus
Week 5 (12/08)
Toolboxes
Mapping
Signal processing
Statistics
Other topics you want to discuss
What is MATLAB?
MATLAB is a simple programming language
with its own extensive library of mathematical
and graphical subroutines
It integrates computation and graphics in one
easy to use interface
MATLAB stands for MATrix LABoratory.
MATLAB is very extendable. There are many
add-ons (toolboxes) for specific requirements
What is MATLAB?
If MATLAB can process and visualize data, why
ever use FORTRAN, C, or some other
language?
MATLAB is an interpreted language
It is not a compiled language
Therefore identical code executes more slowly,
sometimes MUCH more slowly in MATLAB
MATLAB has more memory overhead than
equivalent FORTRAN or C programs
What is MATLAB?
Main Features
Simple programming rules
Extended accuracy
Continuity among integer, real and complex values
Comprehensive mathematical library
Extensive graphics tools
Linkages with other languages
Transportability across environment
MATLAB scripts will work on PC, UNIX, Mac
Starting MATLAB
On UNIX: type matlab at command prompt
Click on the MATLAB icon if you are on a PC
Mac can probably do both
Issues on startup
MATLAB needs a connection to the license server
Check internet connection
Too many users can use all available licenses
Try again later
Starting MATLAB
Once MATLAB is running the GUI (Graphical User
Interface) will appear
Default Window apperance
Starting MATLAB
Command
Window
Main window
in MATLAB
Commands
entered here
Starting MATLAB
MATLAB displays >> prompt when ready for a
command
Will have no >> prompt when processing
commands
Newer versions also say Ready or Busy in
lower left corner of GUI
Can use arrow keys to work through command
history and modify commands
Essentially the same as UNIX command prompt
MATLAB GUI
Current Folder Window
Displays contents of the current
working directory
MATLAB Search Path
Path that MATLAB uses to search for
script and function files
Default path contains all built in
MATLAB functions
Can modify path through MATLAB
function or going under File>Set Path
MATLAB will ask to modify path if
running a program from a folder not in
path
MATLAB GUI
Workspace Window
Shows all currently defined
variables
Array dimensions
Min, max values
Good debugging tool
Command History
Shows all past commands
Can copy and past commands into
command window
Double click will execute command
MATLAB GUI
Other windows include editor window, figure
window, variable editor, help, etc
Will discuss editor and figure window in
upcoming weeks, get to help window in a little
bit
MATLAB GUI
Desktop Menus
File Menu
New
Create new MATLAB
program file (m-file)
Open existing m-file
Import data
Set Path
Open recent m-files
MATLAB GUI
Edit Menu
Copy, cut, paste
Find and replace
phrases
Clear command
history, workspace
Desktop Menu
Change appearance
of desktop
Select windows to
display
Interactive Commands
Enter commands at >> prompt