Matlab

concatenating, Determinant of a matrix, String:

Concatenating Matrices:

If you concatenate two matrices it creates a large matrix. Pair of square braces [] is a concatenate operator.

Matlab as two types of concatenate as follows:

Horizontal concatenation:

When you concatenate two matrix which are separated by using commas, they are called horizontal concatenation.

Vertical concatenation:

When you concatenate two matrix which are separated by using semicolon, they are called vertical concatenation.

Let us consider an example of this two concatenation:

a = [10 12 15; 14 8 6; 17 8 9]

b = [12 11 45; 8 1 -9; 18 2 11]

 c = [a, b]

d = [a; b]

Output will be obtained as

a= 10 12 15

     14 8 16

     17 8 9

b = 12 31 45

      8 0 -9

      45 2 11

 c = 10 12 15 12 11 45

       14 8   16   8   1 -9

       17 8   9   18 2 11

d=10 12 23

     14 8 6

     27 8 9

   12 31 45

   8 0 -9

   45 2 11

Matrix multiplication:

Where in matrix multiplication, the elements of rows in the first matrix is multiplied with the columns in the second matrix.

In matlab matrix multiplication is represented by ‘*’.

In matrix multiplication column in A matrix is equal to rows in B matrix.

Let us consider an example

a = [2 3 4; 1 2 3; 1 3 5]

b = [2 3 -1; 2 1 3; 5 0 -2;]

prod = a * b

Output will be

prod = 30 9 -1

           21 5 -1

           33 6 -2

Determinant of matrix:

Determinant of matrix is determined by using det function in matlab, and it represented of a matrix A is det(A). Let us consider an example.

a = [ 1 2 6; 2 3 4; 1 4 5]

 det(a)

output will be

ans =17

Inverse of Matrix:

The inverse of a matrix in matlab of A is represented by A−1 such which holds the following relationship:

AA−1 = A−1 A = 1

If the determinant of matrix is zero then the inverse will not exist and the matrix is singular.

Inverse of matrix is determined by inv function in matlab and it represented by inv(A)

STRING:

The string is really a vector whose additives are the numeric codes for the characters. Matlab has exclusive kind of textual content string.

Character array: best when considering individual letters of text, text is stored in two-dimensional array. The rule of all rows should have same number of column.

Cell array: best when considering word.

Let us create an uncomplicated string that may include a unique quote.

msg = ‘You”re right!’

            msg =

You’re right!

create the string, name, the usage of strategies of concatenation.

name = [‘Thomas’ ‘ R. ‘ ‘Lee’]

name = strcat(‘Thomas’,’ R.’,’ Lee’)

Create a vertical array of strings.

C = strvcat (‘Hello’,’Yes’,’No’,’Goodbye’)

C =

Hello 

Yes   

No    

Goodbye

Create a cell array of strings.

S = {‘Hello’ ‘Yes’ ‘No’ ‘Goodbye’}

S =

    ‘Hello’    ‘Yes’    ‘No’    ‘Goodbye’

Rajeshwari Chiluveru

Share
Published by
Rajeshwari Chiluveru

Recent Posts

Google Spam Update 2025: Impact, Recovery Guide & SpamBrain Explained

Google released a spam update on 26th of August 2025 and this is affecting a…

2 weeks ago

Google Experiments with Black Sitelink Colors instead of Blue

Google keeps on testing google search display all the time and this time we are…

1 year ago

What are Template Tags in WordPress? How to Use Template Tags

In wordpress if you are developing new or custom wordpress theme or wordpress plugin then…

2 years ago

Google Search Indexing Issues Started on 31st January to February 2024

If you are experiencing indexing issues of your website then you are not alone and…

2 years ago

Create QR Code for Pages & Post using Plugin in WordPress

On your wordpress website if you want to generate qr code for pages and posts…

2 years ago

Add Google Search Console HTML File Upload on WordPress

If you are trying to verify your WordPress website with google search console with html…

2 years ago