Basic commands in Matlab
AIM :- To write the commands to create a row and column vector in Matlab.
Theory :- Using matlab we can create a simple row and column vector
To create a simple row vector we use a square bracket as [ ] or say Array, and placing the numbers in the square bracket. Eg :- [ 10 , 20 , 30 ] creates a simple row vector.
To create a simple column vector we here also use the square bracket but the numbers are provided with ‘semicolon’ one after other . Eg:- [10 ; 20 ; 30 ] creates a column vector as ( ; ) is used .
In linear algebra, a column vector or column matrix is an (m × 1) matrix, that is, a matrix consisting of a single column of m elements, Similarly, a row vector or row matrix is a (1 × m) matrix, that is, a matrix consisting of a single row of m elements
Matlab code:-
Matlab code:-
% Basic commands in matlab
% To create a row vector
Row_vector_A = [10 , 20 , 15 , 10 ]
% To create a column vector
Column_vector_B = [50 ; 10 ; 20 ; 30 ]
Result :- Thus we have created row and column vector using basic commands in matlab.