Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Instructors:
A. Why Matlab?
Some Common Uses for Matlab in Different subjects.
B. Understanding the Matlab Environment:
• Navigating the Matlab Desktop
• Commonly used Toolbox Components
• Executing Commands
• Help and Documentation
C. Using Matlab:
• Matrices, Scalars and Arrays
• Useful Commands
• Searching and Indexing
• Saving and Reloading Work
D. Exercises
Why Matlab?
• Matrix Laboratory
• Created in late 1970’s
• Intended for used in courses in matrix theory,
linear algebra and numerical analysis
• Currently has grown into an interactive system
and high level programming language for general
scientific and technical computation
Why Matlab?
Common Uses for Matlab in Research
• Data Acquisition
• Multi-platform, Multi Format data importing
• Analysis Tools (Existing, Custom)
• Statistics
• Graphing
• Modeling
Why Matlab?
Data Acquisition
• A framework for bringing live, measured data into
MATLAB using PC-compatible, plug-in data
acquisition hardware
Why Matlab?
Multi-platform, Multi Format data importing
• Data can be loaded into Matlab from almost any format and platform
• Binary data files (eg. REX, PLEXON etc.)
• Ascii Text (eg. Eyelink I, II)
• Analog/Digital Data files
PC
100101010
Subject 1 143
UNIX
Subject 2 982
Subject 3 87 …
Why Matlab?
Analysis Tools
• A Considerable library of analysis tools exist for data
analysis
• Provides a framework for the design, creation, and
implementation of any custom analysis tool imaginable
Why Matlab?
Statistical Analysis
• A considerable variety of statistical tests available
including:
– Mann-Whitney Test
– Rank Sum Test
– ANOVAs
– Linear Regressions
– Curve Fitting
Why Matlab?
Graphing
• A Comprehensive array of plotting options
available from 2 to 4 dimensions
• Full control of formatting, axes, and other visual
representational elements
Why Matlab?
Modeling
• Models of complex dynamic system interactions
can be designed to test experimental data
Understanding the Matlab
Environment:
Navigating the Matlab Desktop…..
Commonly Used Toolboxes…..
Executing Commands
Basic Calculation Operators:
+ Addition
- Subtraction
* Multiplication
/ Division
^ Exponentiation
Using Matlab
Solving equations using variables
Expression language
• Expressions typed by the user are interpreted and evaluated by
the Matlab system
• Variables are names used to store values
• Variable names allow stored values to be retrieved for
calculations or permanently saved
>> x = 6 >> x * y
Variable = Expression
x=6 Ans = 12
Or
>> y = 2 >> x / y
Expression
y=2 Ans = 3
>> x + y >> x ^ y
**Variable Names are Case Sensitive!
Ans = 8 Ans = 36
Using Matlab
Working with Matrices
• Matlab works with essentially only one kind of object, a
rectangular numerical matrix
• A matrix is a collection of numerical values that are organized into
a specific configuration of rows and columns.
• The number of rows and columns can be any number
Example
3 rows and 4 columns define a 3 x 4 matrix having 12 elements
>> A(1,2) = 9
Ans
A = [1 2 4 5
9 3 8 2]
Using Matlab
Matrix Shortcuts
Example
a = ones(2,3) b = zeros(1,5)
a = [1 1 b = [0 0 0 0 0]
11
1 1]
Using Matlab
Data Types and Formats
4 8 41 166 42
22 55 28 16 2
C= D=
16 0 0 1 12 E = a 5 x 9 matrix of 1’s
160 25 65 24 19
Exercises
Use the who and whos functions to confirm all of the
variables and matrices in the work space are
present and correct
1 21 6
A = 5 17 9 B = 1 64 122 78 38 55
31 2 7
D = 65
4 8 41 166 42
22 55 28 16 2
C= D=
16 0 0 1 12 E = a 5 x 9 matrix of 1’s
160 25 65 24 19
Exercises
Change the following elements in each matrix:
1 76
6 6
A = 5 17 9 B = 1 76 0 38 55
64 122 78
31 0
2 7
D = 65
4 8 41 166 42
22 55
76 28 16
0 2
C= D=
76
16 0 0 1 12 E = a 5 x 9 matrix of 1’s
160 25 19
65 24 76