Professional Documents
Culture Documents
Programming
Strengths
Free and Open Source
Weakness
Steep learning curve
High Level
Languages such as
C, Pascal etc.
Assembly
What is MATLAB?
Development Environment
MATLAB language
Application Programming
Language
Matlab Screen
Command Window
type commands
Current Directory
View folders and m-files
Workspace
View program variables
Command History
view past commands
using diary
Arrays, Vectors, and Matrices
Array :
A collection of data elements
arranged in rows and columns
Vector:
A one-dimensional array (single >> A=[1:9] row or column?
row or single column of data
elements) >> B=[1:9]‟ column vector
Matrix :
>> C=[1:3; 4:6; 7:9]
A two-dimensional array (more
than one row and/or column of
C=
data elements) 1 2 3
4 5 6
7 8 9
Variables
No need for types. i.e.,
int a;
double b;
float c;
plot(.) 0.6
0.5
0.4
Example: 0.3
>>x=linspace(0,4*pi,100); 0.2
>>y=sin(x); 0.1
>>plot(y)
0
-0.1
>>plot(x,y) -0.2
-0.3
0 10 20 30 40 50 60 70 80 90 100
stem(.)
0.7
0.6
0.5
0.4
Example:
0.3
0.2
>>stem(y) 0.1
>>stem(x,y) 0
-0.1
-0.2
-0.3
0 10 20 30 40 50 60 70 80 90 100
Display Facilities
title(.)
0.8
0.6
xlabel(.) 0.4
0.2
sin(x)
0
-0.2
>>xlabel(‘x (secs)’) -0.4
-0.6
ylabel(.) -0.8
-1
0 10 20 30 40 50 60 70 80 90 100
x (secs)
>>ylabel(‘sin(x)’)
MATLAB WORKSHOP
WORKSHOP
WebPages
www.csee.wvu.edu/~jalali
Advantages of MATLAB