0% found this document useful (0 votes)
29 views4 pages

TUGAS 2 Anum

The document shows examples of MATLAB commands being used to perform calculations and operations on matrices and vectors. It includes commands to calculate values, create matrices filled with zeros and ones, generate linearly spaced vectors, and access elements of matrices.

Uploaded by

Dimas Irfan
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)
29 views4 pages

TUGAS 2 Anum

The document shows examples of MATLAB commands being used to perform calculations and operations on matrices and vectors. It includes commands to calculate values, create matrices filled with zeros and ones, generate linearly spaced vectors, and access elements of matrices.

Uploaded by

Dimas Irfan
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/ 4

MATLAB Command Window Page 1

>> 25 + 40 / 34 - 17

ans =

9.1765

>> 56+72-16/4*8+50

ans =

146

>> 34/6+186-57*12

ans =

-492.3333

>> 27^4*15+120-48

ans =

7971687

>> sqrt(65536)+35-124/12

ans =

280.6667

>> sqrt(175+256*12/8)

ans =

23.6432

>> sqrt(105+23-58*25-100/8)

ans =

0.0000 +36.5308i

>> ans+34/6+186-57*15

ans =

-6.6333e+02 + 3.6531e+01i

>> cos(pi/3)

ans =

0.5000

>> sin(pi/2)+cos(pi/3)
MATLAB Command Window Page 2

ans =

1.5000

>> tan(pi*4)+cos(pi*3)

ans =

-1.0000

>> sin(pi/4)+tan(pi/2)-cos(pi/2)

ans =

1.6331e+16

>> A=[6 9 7 8 11 9
12 9 8 4 10 7
6 14 9 6 9 6
8 4 7 9 11 5
4 12 9 6 8 10]

A =

6 9 7 8 11 9
12 9 8 4 10 7
6 14 9 6 9 6
8 4 7 9 11 5
4 12 9 6 8 10

>> A(4,5)

ans =

11

>> A(2,3)

ans =

>> A(3,:)

ans =

6 14 9 6 9 6

>> A(:,4)

ans =

8
4
MATLAB Command Window Page 3

6
9
6

>> E=zeros(9,7)

E =

0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0
0 0 0 0 0 0 0

>> E=ones(10,6)

E =

1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1
1 1 1 1 1 1

>> t=12:4:256

t =

Columns 1 through 15

12 16 20 24 28 32 36 40 44 48 52 56 60 64
68

Columns 16 through 30

72 76 80 84 88 92 96 100 104 108 112 116 120 124


128

Columns 31 through 45

132 136 140 144 148 152 156 160 164 168 172 176 180 184
188

Columns 46 through 60

192 196 200 204 208 212 216 220 224 228 232 236 240 244
MATLAB Command Window Page 4

248

Columns 61 through 62

252 256

>> t=115:1,5:5

t =

Empty matrix: 1-by-0

ans =

>> linspace (3,7,11)

ans =

Columns 1 through 9

3.0000 3.4000 3.8000 4.2000 4.6000 5.0000 5.4000 5.8000


6.2000

Columns 10 through 11

6.6000 7.0000

>> linspace (-5,5,12)

ans =

Columns 1 through 9

-5.0000 -4.0909 -3.1818 -2.2727 -1.3636 -0.4545 0.4545 1.3636


2.2727

Columns 10 through 12

3.1818 4.0909 5.0000

>>

You might also like