# FUN WITH MATRICES Using MATLAB

One question people:
Basically, what does MatLab deals with?
Hmm…. Obviously Matrices!! :p

Yeah, so let’s do something with matrices this time.
To create a Row matrix or a Column matrix simply use the square brackets.

Example:-Let A be a matrix .
A= [1 2 3 4 5 6]
This will create a row matrix as shown:
1 2 3 4 5 6
And to create a column matrix, do this:
B= [1;2;3;4]
1
2
3
4
So, we use semi-colon to create columns.
What about a n x n matrix?
To create 3 X 3 matrix :
Q=[1 2 3;4 5 6;7 8 9]
1 2 3
4 5 6
7 8 9
And now let’s take the transpose:- V=Q’
1 4 7
2 5 8
3 6 9
Just an apostrophe has been used.
Suppose in future we have to use an element of a given matrix, it will be tiresome if we rewrite
element again and again….
So, we use simple commands to access the elements as shown:- V(1:3,1:2)
1 4
2 5
3 6
1:3 gives the row to be accessed and 1:2 the columns to be accessed.
Before the comma specify the row numbers and after the comma specify the column numbers!!
So, that’s all for now!
No, wait one more thing.
To produce a column matrix we can type this V(:) and to produce a row matrix type this V(1:end).
Let’s wind up and see you in the next article and also do drop in your comments

Pulkit Khandelwal,
Student
VIT University, Vellore.