SCALAR, VECTOR AND MATRICES
Scalar
| Real Numbers | a = 5 |
Vector
| A collection of numbers arranged in :
| column vector : |
Matrix
| Ordered set of scalars arranged in a rectangular pattern. | A= |
- Scalar:
>> a = 5
a =
5
- Row vector:
>> b = [1 2 3]
b =
1 2 3
- Column vector:
>> c = [1;2;3]
c =
1
2
3
- Matrix:
>> A = [1 2 3; 4 5 6; 7 8 9]
A =
1 2 3
4 5 6
7 8 9
- To display number of rows and column of the matrix:
>> size(A)
ans =
3 3
>> [row, column] = size(A)
row =
3
column =
3
>> [row, column] = size(c)
row =
3
column =
1
- To list the elements in certain row or column
>> C = A(3 , :)
C =
7 8 9
>> D = A(: , 3)
D =
3
6
9
No comments:
Post a Comment