Professional Documents
Culture Documents
Introduction To Matlab
Introduction To Matlab
Matlab
• Stands for MATrix LABoratory
• Interpreted language
• Scientific programming environment
• Very good tool for the manipulation of matrices
• Great visualisation capabilities
• Loads of built-in functions
• Easy to learn and simple to use
2
What is Matlab?
• Matlab is basically a high level language which
has many specialized toolboxes for making
things easier for us
• How high?
Matlab
High Level
Languages such as
C, Pascal etc.
Assembly
Matlab Desktop
Workspace /
Current Directory
Command Window
Command
History
5
Basic MATLAB Interface
Command window:
Type your instructions
here and press ENTER
to execute them.
6
Basic MATLAB Interface
7
Simple calculations
8
What are we interested in?
• Matlab is too broad for our purposes in this
course.
• The features we are going to require is
Matlab
Series of
Matlab
commands
Command
m-files mat-files
Line
Matlab comment
prompt operator
suppress
assign
command
operator
output
Try the same line without
the semicolon and
Introduction to Matlab comments
10
Sumitha Balasuriya
Some special variables and constants are:
11
Some Useful MATLAB commands
13
Example: search for
function mean
14
Create an m-file
To create an m-file,
1) type edit at the command
window, or
2) Press this button.
16
Create an m-file
17
Create an m-file
18
Save an m-file Note the file name will be changed …
19
Run an m-file
20
Run an m-file
21
Run an m-file
22
Basic
1. Arithmetic Assignment 13. If-Else & if-Else-if
2. Mathematical 14.Switch
Assignment 15.Logical Operator
3. Vector Assignment 16.Complex Number
4. Linear Equation Assignment
5. Basic Plot & Subplot 17.Inline Function
6. Basic Operation on 18. User Define Function
Matrix 19.Discontinued Graph
7. Subscripts 20.Avoid Divide by zero
8. Writing Scripts File 21.Avoid infinity
9. Operator Precedence 22.Rand function
10. Loops 23.Roll Dice Problem
11. If-Statement
12. While Statement
Matrix Operation
1. Creating Matrix
2. Concenation
3. Subscript
4. Matrix multiplication
5. Element-wise Matrix Operation
6. Repmat
7. Deletion of Row/Column
8. Eye, Magic, Pascal, Zeros, Ones
9. Diag, fliplr, flipud, rot90, tril, triu
10. Sum, Inv, Det, Eig
Differential Equation
1. First Order Differential Equation
2. Dsolve-Analytic view
3. Ode45-Numerical view
4. Symbolic view
5. Use of Debugger in Code
6. 2nd Order Differential Equation
Polynomial
1. Polynomial Representation
2. Roots of Polynomial
3. Poly, Polyval, Conv, Deconv, Polyfit
Interpolation
1. Interp2 type
2. Nearest, bilinear, bicubic, spline
Signal Processing
1. Generation of Signal
2. Step, ramp, impulse
3. Sawtooth, square
4. AM Modulation/Demodulation
5. FM Modulation/Demodulation
6. PM Modulation/Demodulation
Image Processing