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

Week 1

The document is a MATLAB code summary from Week 1. It introduces basic MATLAB operations like creating matrices, performing arithmetic operations, finding the inverse, determinant, and rank of matrices, accessing matrix elements, and using functions like diag, tril, and triu on matrices. These operations are demonstrated through examples of creating and manipulating 2x2 matrices.

Uploaded by

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

Week 1

The document is a MATLAB code summary from Week 1. It introduces basic MATLAB operations like creating matrices, performing arithmetic operations, finding the inverse, determinant, and rank of matrices, accessing matrix elements, and using functions like diag, tril, and triu on matrices. These operations are demonstrated through examples of creating and manipulating 2x2 matrices.

Uploaded by

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

MATLAB

Name: Dhivya Shrilaa T.J


Reg. no.: 18bec1071
Date: 20/07/2018
Slots: L59,L60

Introduction
Week 1:
*Program:

a=[1 2;3 4]
Output in command window:
a =

1 2
3 4

*Program:
b=[5 6;7 8]

Output:

b =

5 6
7 8

*Program:
a+b

Output:
ans =

6 8
10 12

*Program:
a-b

Output:
ans =

-4 -4
-4 -4
*Program
a*b

Output:
ans =

19 22
43 50

*Program:
a.*b

Output:
ans =

5 12
21 32

*Program:
a./b

Output:
ans =

0.2000 0.3333
0.4286 0.5000

*Program:
inv(a)

Output:
ans =

-2.0000 1.0000
1.5000 -0.5000

*Program:
det(a)

Output:
ans =

-2

*Program:
rank(a)

Output:
ans =

2
*Program:
diag(a)

Output:
ans =

1
4

*Program
a(2,:)

Output:
ans =

3 4

*Program:
a(2,:)=[]

Output:
a =

1 2

*Program:
b(:,1)

Output:
ans =

5
7

*Program:
trace(b)

Output:
ans =

13

*Program:
tril(b)

Output:
ans =

5 0
7 8
*Program:
triu(b)

Output:
ans =

5 6
0 8

You might also like