Professional Documents
Culture Documents
N
TO MATLAB
INTRODUCTION
Matlab- which stands for MATrix LABoratory, is a highperformance language for technical computing.
It integrates computation, visualization, and programming
in an easy-to-use
environment where problems and solutions are expressed
in familiar
mathematical notation.
APPLICATION OF
MATLAB
Math and computation
Algorithm development
Data acquisition
Modeling, simulation, and prototyping
Data analysis, exploration, and visualization
Scientific and engineering graphics
Application development, including graphical user
interface building
MATLAB SYSTEM
Development Environment.
The MATLAB Mathematical Function Library.
The MATLAB Language.
Graphics.
The MATLAB Application Program Interface (API).
MATLAB INTERFACE
Command Window
type commands
Current Directory
View folders and m-files
Workspace
View program variables
Double click on a variable
to see it in the Array Editor
Command History
view past commands
save a whole session
using diary
Variables
No need for types. i.e.,
int a;
double b;
float c;
Example:
>>x=5;
>>x1=2;
Array, Matrix
a vector
x =
1
2
x = [1 2 5 1]
a matrix
z = [1 2 3; 5 1 4; 3 2 -1]
z =
1
5
2
1
3
4
transpose y
-1
= x
y =
1
2
5
1
t =1:10
t =
k =2:-0.5:-1
k =
1.5
0.5
= [1:4; 5:8]
B =
1
5
2
6
3
7
4
8
-0.5
-1
10
Matrix Index
Operators (arithmetic)
Matrices Operations
Given A and B:
Addition
Subtraction
Product
Transpose
Operators (Element by
Element)
b= e f
c d
a.*b =
ae bf
cg dh
A(:, 2)=[]
Delete second column
1 2
3
I=1
2
3
Concatenation of
Matrices
x = [1 2], y = [4 5], z=[ 0 0]
A = [ x y]
B = [x ; y]
1 2
4 5
C = [x y ;z]
Error:
??? Error using ==> vertcat CAT arguments dimensions are not consistent.