MATLAB Workshop Lecture 1
MATLAB Workshop Lecture 1
MATLAB WORKSHOP
WORKSHOP
• FOR EE 327
• MWF 8:00-850 AM
• August 26-30, 2002
Mainly
Mainly this
this workshop
workshop is is
designed
designed for
for EEEE 327,
327,
Signals
Signals and
and Systems
Systems 11
course.
course. But
But itit could
could be
be used
used
by
by any
any other
other faculty
faculty and
and
students
students who
who areare interested
interested
to
to learn
learn MATLAB
MATLAB
ABOUT
ABOUT WORKSHOP
WORKSHOP
This
Thisworkshop
workshopis isavailable
availableas
asaasupplement
supplementto tothe
the
textbook
textbookContemporary
ContemporaryLinear
LinearSystems
SystemsUsing
Using
MATLAB
MATLABby byRobert
RobertD.D. Strum
Strumand
andDonald
DonaldE.E. Kirk.
Kirk.
This
Thisis
isthe
themain
maintextbook
textbookfor
forEE
EE327
327in
infall
fall 2002.
2002.
The
Theworkshop
workshopcovers
coversbasic
basicMATLAB
MATLABcommands
commands
that
thatare
areused
usedin
inintroductory
introductorysignals
signalsand
andsystems
systems
analysis.
analysis.
ItItis
ismeant
meanttotoserve
serveas
asaaquick
quickway
wayto
tolearn
learnMATLAB
MATLAB
and
andaaquick
quickreference
referenceto
tothe
thecommands
commandsthatthatare
are
used
usedin inthis
thistextbook.
textbook.
ABOUT
ABOUT WORKSHOP
WORKSHOP
In
In this
this workshop
workshop you you will
will learn
learn aa few
few of
of
the
the basic
basic functions
functions of of MATLAB.
MATLAB.
First
First we
we will
will start
start working
working withwith basic
basic
numbers,
numbers, formats,
formats, demos,
demos,
mathematical
mathematical functions,
functions, setting
setting
variables,
variables, matrices
matrices and
and generating
generating
plots
plots byby using
using thethe plot
plot functions.
functions.
Brief
Brief overview
overview of of how
how toto generate
generate
scripts
scripts inin MATLAB
MATLAB called
called M-files.
M-files.
ABOUT
ABOUT WORKSHOP
WORKSHOP
The
The workshop
workshop is is designed
designed for
for students
students
using
using either
either the
the professional
professional version
version of of
MATLAB
MATLAB with with the
the Control
Control Systems
Systems Toolbox
Toolbox
and
and the
the Signal
Signal Processing
Processing Toolbox,
Toolbox, or or using
using
the
the Student
Student Edition
Edition ofof MATLAB.
MATLAB.
For
For latest
latest version
version of of MATLAB
MATLAB at at the
the time
time and
and
more
more information
information on on MATLAB,
MATLAB, contact
contact
The
The Mathworks,
Mathworks, Inc
Inc..
www.mathworks.com
www.mathworks.com
MATLAB
MATLAB WORKSHOP
WORKSHOP
WORKSHOP
WebPages
www.csee.wvu.edu/~jalali
MATLAB
MATLAB WORKSHOP
WORKSHOP
Lecture # 1
Monday August 26
• Introduction
• MATLAB Demos
• MATLAB Basics
Lecture # 2
Wednesday August 28
• MATLAB Basics
• MATLAB Plots
• MATLAB Examples
Lecture # 3
Friday August 30
• MATLAB Fundation
• Textbook Examples
• Short Quiz
MATLAB
MATLAB WORKSHOP
WORKSHOP
Lecture # 1
Monday August 26
• Introduction
• MATLAB Demos
• MATLAB Basics
MATLAB
MATLAB Introduction
Introduction
MATLAB
MATLAB is is both
both computer
computer
programming
programming language language and
and software
software
environment
environment for for using
using that
that language
language
effectively.
effectively.
MATLAB
MATLAB is is matrix-oriented,
matrix-oriented, so so what
what
would
would taketake several
several statements
statements in in C
C or
or
Fortran
Fortran cancan usually
usually bebe accomplished
accomplished
in
in just
just aa few
few lines
lines using
using MATLAB's
MATLAB's
built-in
built-in matrix
matrix and and vector
vector operations
operations
MATLAB
MATLAB Introduction
Introduction
FORTRAN:
FORTRAN:
real*8
real*8 A(10,10),
A(10,10), B(10,10),
B(10,10), C(10,10)
C(10,10)
do
do i=1,10
i=1,10
do
do j=1,10
j=1,10
C(i,j)
C(i,j) == A(i,j)
A(i,j) ++ B(i,j)
B(i,j)
10
10 continue
continue
20
20 continue
continue
MATLAB:
MATLAB:
C
C == A
A ++ B
B
MATLAB
MATLAB Introduction
Introduction
MATLAB
MATLAB isis available
available
for
for MS
MS Windows,
Windows,
Macintosh
Macintosh personal
personal
computer,
computer, Unix
Unix and
and
other
other operating
operating
systems.
systems.
MATLAB
MATLAB Introduction
Introduction
MATLAB,
MATLAB, which
which stands
stands forfor
MATrix
MATrix LABoratory,
LABoratory, is
is aa
powerful,
powerful, general-purpose
general-purpose
system
system oror environment
environment forfor
doing
doing mathematics,
mathematics,
scientific
scientific and
and engireeng
engireeng
calculations.
calculations.
MATLAB
MATLAB Introduction
Introduction
MATLAB
MATLAB is is aa "High-
"High-
Performance
Performance Numeric
Numeric
Computation
Computation and and
Visualization
Visualization Software"
Software"
package.
package.
MATLAB
MATLAB Introduction
Introduction
MATLAB
MATLAB is is an
an
interactive
interactive system
system
whose
whose basic
basic data
data is
is aa
matrix
matrix that
that does
does not
not
require
require dimensioning.
dimensioning.
MATLAB
MATLAB Introduction
Introduction
MATLAB
MATLABsupports
supportsmanymanytypes
typesof
ofgraph
graphand
andsurface
surface
plots:
plots:
•• line
lineplots
plots(x
(xvs.
vs. y),
y),
•• filled
filledplots,
plots,
•• bar
barcharts,
charts,
•• pie
piecharts,
charts,
•• parametric
parametricplots,
plots,
•• polar
polarplots,
plots,
•• contour
contourplots,
plots,
•• density
densityplots,
plots,
•• log
logaxis
axisplots,
plots,
•• surface
surfaceplots,
plots,
•• parametric
parametricplots
plotsinin33dimensions
dimensionsand
andspherical
spherical
plots.
plots.
MATLAB
MATLAB Introduction
Introduction
•• MATLAB
MATLABhas hasaanumber
numberof ofadd-on
add-onsoftware
softwaremodules,
modules,
called
called toolbox
toolbox,, that
thatperform
performmore
morespecialized
specialized
computations.
computations.
Signal
Signal &&Image
ImageProcessing
Processing
Signal
SignalProcessing-
Processing- Image
ImageProcessing
Processing Communications
Communications
-- System
SystemIdentification
Identification -- Wavelet
Wavelet Filter
FilterDesign
Design
Control
Control Design
Design
Control
Control System
System--Fuzzy
FuzzyLogic
Logic --Robust
RobustControl
Control --µ-
µ-
Analysis
Analysisand andSynthesis
Synthesis --LMILMI Control
Control --Model
Model
Predictive
PredictiveControl
Control Model-Based
Model-BasedCalibration
Calibration
More
More than
than 60
60 toolboxes!
toolboxes!
MATLAB
MATLAB Introduction
Introduction
•• In
In Windows
Windows
systems
systems
MATLAB
MATLAB is is
started
started by
by
double-clicking
double-clicking
the
the mouse
mouse onon
the
the appropriate
appropriate
icon.
icon.
MATLAB
Command
Window
File
Edit
View
View
View
Web
Help
MATLAB
MATLAB Introduction
Introduction
MATLAB
MATLAB includes
includes hundreds
hundreds
of
of functions
functions for:
for:
•• Data
Data analysis
analysis and
and visualization,
visualization,
•• Numeric
Numeric and
and symbolic
symbolic computation,
computation,
•• Engineering
Engineering and
and Scientific
Scientific graphics,
graphics,
•• Modeling,
Modeling, simulation,
simulation, and
and prototyping,
prototyping,
•• Eigenvalue,
Eigenvalue, singular
singular value
value
MATLAB
MATLAB Demos
Demos
•• Demonstrations
Demonstrations are are
invaluable
invaluable since
since they
they
give
give an
an indication
indication ofof
the
the MATLAB
MATLAB
capabilities.
capabilities.
•• AA comprehensive
comprehensive set set
are
are available
available by
by
typing
typing the
the command
command
>>demo
>>demo in in MATLAB
MATLAB
prompt.
prompt.
MATLAB
MATLAB Demos
Demos
MATLAB
MATLAB works
works with
with scalars,
scalars,
vectors
vectors and
and matrices:
matrices:
•• Basic
Basic matrix
matrix operations,
operations,
•• Inverses
Inverses of
of matrices,
matrices,
•• Graphs
Graphs of
of matrices,
matrices,
•• Matrix
Matrix manipulation,
manipulation,
•• Programming,
Programming, application
application
development,
development, and
and GUI
GUI design
design
MATLAB
MATLAB Demos
Demos
MATLAB
MATLAB has
has remarkable
remarkable
graphics
graphics capacities:
capacities:
•• 2-D
2-D and
and 3-D
3-D plots,
plots,
•• Line
Line plotting,
plotting,
•• 3-D
3-D surface
surface plot,
plot,
•• Splash
Splash screen
screen plot,
plot,
•• Plot
Plot of
of complex
complex functions
functions and
and ...
...
MATLAB
MATLAB Demos
Demos
MATLAB
MATLAB hashas remarkable
remarkable graphics
graphics
capacities,
capacities, 3_D
3_D plots
plots are
are some
some of
of
them:
them:
•• 3-D
3-D plots
plots in
in Handel
Handel Graphics
Graphics
•• Plot
Plot Type,
Type,
•• Shading,
Shading,
•• Colomap,
Colomap,
•• Axis
Axis and
and ...
...
MATLAB
MATLAB Demos
Demos
MATLAB
MATLAB hashas remarkable
remarkable graphics
graphics
capacities,
capacities, gallery
gallery is
is one
one of
of them:
them:
•• The
The Gallery
Gallery is is aa place
place to
to hang
hang particularly
particularly
elegant
elegant examples
examples of of graphics
graphics visualization
visualization
in
in MATLAB.
MATLAB.
•• Knot,
Knot,
•• Quiver,
Quiver,
•• Klein
Klein II,
II,
•• Cruller
Cruller and
and ...
...
MATLAB
MATLAB Demos
Demos
MATLAB
MATLAB hashas many
many
toolboxes:
toolboxes:
•• Control
Control toolbox
toolbox isis one
one of
of the
the
important
important toolbox
toolbox in
in MATLAB.
MATLAB.
•• RLC
RLC Circuit
Circuit Response,
Response,
•• Gain
Gain and
and Phase
Phase Margins,
Margins,
•• Notch
Notch Filter
Filter Discrete,
Discrete,
•• PID
PID and
and ...
...
MATLAB
MATLAB Demos
Demos
MATLAB
MATLAB has
has many
many toolboxes:
toolboxes:
•• Signal
Signal Processing
Processing toolbox
toolbox is
is one
one of
of
the
the important
important toolobx
toolobx in
in MATLAB.
MATLAB.
•• Designing
Designing Filter,
Filter,
•• Filtering
Filtering aa Signal,
Signal,
•• Discrete
Discrete and
and Continuous
Continuous Fourier
Fourier
Transform,
Transform,
•• Spectral
Spectral Analysis
Analysis and
and ...
...
MATLAB
MATLAB Demos
Demos
•• Simulink
Simulink has
has the
the ability
ability to
to
simulate
simulate aa large
large range
range ofof
systems,
systems, from
from very
very simple
simple toto
extraordinarily
extraordinarily complex.
complex. TheThe
Model
Model and
and demonstrations
demonstrations that that
you
you will
will see
see in
in this
this section
section
include
include both
both simple
simple and
and
complex
complex systems.
systems.
MATLAB
MATLAB Demos
Demos
Simulink
Simulink has
has the
the ability
ability to
to
simulate
simulate aa large
large range
range of
of systems,
systems,
in
in the
the menu
menu ofof Simulation
Simulation we we
have:
have:
•• Pause.
Pause.
•• Stop,
Stop,
•• Simulation
Simulation Parameters,
Parameters,
•• Start,
Start,
MATLAB
MATLAB WORKSHOP
WORKSHOP
End of Lecture # 1
MATLAB Basics
Next time