0% found this document useful (0 votes)
31 views

Basic Simulation Lab 2

Uploaded by

kaushal bhagat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Basic Simulation Lab 2

Uploaded by

kaushal bhagat
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

LAB WORK:

Submitted by – KAUSHAL BHAGAT


Enrollment number – A35705220009
Course Code – ES204
Course name – Basic Simulation Lab
Batch – 2020-24
Submitted to – Mr.Pritam Keshari Sahoo
Experiment-2
AIM –
Performing Matrix Manipulations-
Concatenating,Indexing,Sorting,Shifting,Reshaping,Resiz
ing and Flipping about a Vertical Axis/Horizontal Axis;
Creating Arrays X & Y of given size (1 x N) and
Performing (A).Relational operations - >,<=,>=,~=
(B).Logical Operations-~,&,|,XOR

A=

2 4 3

5 6 8

9 8 7

B=

2 5 8

5 9 4

4 7 5

2 4 3
5 6 8

9 8 7

2 5 8

5 9 4

4 7 5

Horizontal

concatenation C=

2 4 3 2 5 8

5 6 8 5 9 4

9 8 7 4 7 5
Indexing two matrices

D=

5 5 4

9 7 4

5 4 8

Sorting row wise

F=

2 4 3

5 6 7

9 8 8

Sorting column wise

F=

2 3 4

5 6 8

7 8 9

H=
2 3 4 5

8 1 2 0

6 9 3 7

Reshaping the matrix

G=

2 6 1 4 3 0

8 3 9 2 5 7

Rotating a matrix
I=

0 7

3 5

4 2

1 9

6 3

2 8

7 0

5 3

2 4

9 1

3 6

8 2

Resizing a matrix

G=
2 6 1 4 3 0

G=

2 1 4 3 0

Shifting a matrix

K=

0.1875 0.7690 0.6733 0.0594

0.2662 0.3960 0.4296 0.3158

0.7978 0.3960 0.4517 0.7727


0.4876 0.037 0.6099 0.6964

I=

0.0372 0.6099 0.6964 0.4876

0.7690 0.6733 0.0594 0.1875

0.3960 0.4296 0.3158 0.2662

0.2729 0.4517 0.7727 0.7978

Using>=operator

Ans=

0 1 1

1 1 0

0 0 0

Using <=operator

Ans

1 0 0

0 1 1

1 1 1

Using~=operator

Ans=

1 1 1

1 0 1

0 0 0

Using<operator

Ans=

1 0 0
0 0 1
1 1 1

M=

1 5

8 0

N=

2 0

0 5

Using and

operator Ans=

1 0

0 0

Using not

operator Ans=

0 0

0 1

Using or operator

Ans=
1 1

1 1

Using xor operator

Ans=

0 1

1 1

You might also like