English-Tutorial-7: MATRIX handling in MATLAB-2013a

English-Tutorial-7: MATRIX handling in MATLAB-2013a:

 


 

 

A matrix is a rectangular array of some numbers, which are provide by 3rd bracket []. There are 6 type of matrix in algebra.

 

  1. Square matrix:

If the number of rows and number of columns are same it’s called square matrix. For example below:

 1

  1. Column vector:

If a matrix have only one columns it’s called column vector. For example please see below:

 

 2

  1. Row vector.

If a matrix have only one row so it’s called row matrix. For example see below:

 3

  1. Diagonal matrix.

A square matrix where number’s position will be diagonal and zeros will be another position of diagonal. See example below:

 4

  1. Scalar and Identity matrix.

 

 5

  1. Triangular matrix.

6

All are matrix application we can do solve with MATLAB. MATLAB are primarily designed for solve matrix application. Now we will see some MATRIX operation via command window. Go to command window and type with me,

Array Creation: For create any array on MATLAB please type this code on the command window,

>> x = [12 14 25 30]

After type this code press enter so you will see the output, see below,

 array-matrix

See here the output showing with single row, if you want to make different row for different number, just make change this code with below,

>> x = [12 12 12; 13 13 13; 14 14 14]

After type this code press enter so you will see the output, see below,

doble-row-matrix

If you want to see one column and different row, just use function such as zeros, ones and rand, see below for example of code,

x = zeros(5,1), x = ones(5,1) and x = rand(5,1) type this codes sequentially between enter, so you can see different result on your command window.

single-window

Matrix and array operation:

If you want to do arithmetic operation between an array and a single arithmetic operation, so just do this code below,

 

  a = [1 2 3] and a+10 type this codes sequentially between space, so you are able to see accurate output.

arrithmetic

Again with >> a = [1 2 3] and >> sin(a) and see below result,

 sin

Again for to transpose matrix use this code below,

>> a = [1 2 3; 4 5 6; 7 8 9] and >> a’ type this codes with previously method, see result below,

 quate

Concatenation:

Some time we need to do showing two array matrix one by one alongside. Type this codes below for do it,

>> a = [5 6 4; 4 6 5; 8 4 9], >> b = [12 14 15; 41 10 13; 21 31 33] and >> c = [a,b] type this codes the same way and see output below,

beside-matrix

Some time we need to do showing two array matrix one by one below. Type this codes below for do it,

>> a = [5 6 4; 4 6 5; 8 4 9], >> b = [12 14 15; 41 10 13; 21 31 33] and >> c = [a; b] type this codes the same way and see output below,

 below-matrix

This is only for learn basic matrix operation, if want to make change your experience please visit http://www.mathworks.com

Write Your Comments

comments

Leave a Reply