A vector is a one-dimensional array of numbers. MATLAB allows creating two types of vectors:
Row vectors
Column vectors
Row vectors are created by enclosing the set of elements in square brackets, using space or comma to delimit the elements.
r = [7 8 9 10 11]
MATLAB will execute the above statement and return the following result:
r =
Columns 1 through 4
7 8 9 10
Column 5
11
Column vectors are created by enclosing the set of elements in square brackets, using semicolon to delimit the elements.
c = [7; 8; 9; 10; 11]
MATLAB will execute the above statement and return the following result:
c =
7
8
9
10
11
Row vectors
Column vectors
Row Vectors
r = [7 8 9 10 11]
MATLAB will execute the above statement and return the following result:
r =
Columns 1 through 4
7 8 9 10
Column 5
11
Column Vectors
Column vectors are created by enclosing the set of elements in square brackets, using semicolon to delimit the elements.
c = [7; 8; 9; 10; 11]
MATLAB will execute the above statement and return the following result:
c =
7
8
9
10
11
No comments:
Post a Comment