Creating Column Vectors

Method 1:

The simplest way of creating column vectors in MATLAB is by using the ‘;’ separator. See the example below.

Example 1:

Matlab




% MATLAB Create Column Vectors
vec = [1;2;3;4;5]


Output:

This will create a column vector with 5 rows.

 

Method 2:

A column vector is the transpose of a row vector so, we can convert a row vector into a column vector by taking its transpose.

Example 2:

Matlab




% MATLAB code for creating a row vector
vec = 3:13;       
 
% Displaying the row vector
disp(vec)   
 
% Computing the transpose of vec
vec = vec';
 
% Displaying the transpose of row vector vec
disp("Transpose of row vector is:")
disp(vec)


Output:

 

Column Vectors in MATLAB

Column vectors are vectors that have a single column but, multiple rows. MATLAB provides various functions that use column vectors as their arguments. In this article, we will see different methods of creating and using column vectors in MATLAB.

Similar Reads

Creating Column Vectors:

Method 1:...

Uses of Column Vectors:

...