Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 6

1. a.

>> p='pada musim penghujan banyak sekali pohon yang rubuh'

p=

'pada musim penghujan banyak sekali pohon yang rubuh'

>> t=p(5:34)

t=

' musim penghujan banyak sekali'

b. >> w=[2 5 7 9 11 13]

w=

2 5 7 9 11 13

>> x=[12 15 17 19 21 23 25 27]

x=

12 15 17 19 21 23 25 27

>> y=[3 8 12 15 17 13; 11 9 21 23 20 17; 3 13 13 17 19 23; 13 41 53 33 37 39; 43 21 31 35 37 47; 21 23


27 31 34 29]

y=

3 8 12 15 17 13
11 9 21 23 20 17

3 13 13 17 19 23

13 41 53 33 37 39

43 21 31 35 37 47

21 23 27 31 34 29

>> max(w)

ans =

13

>> min(x)

ans =

12

>> min(w,y)

ans =

2 5 7 9 11 13

2 5 7 9 11 13

2 5 7 9 11 13

2 5 7 9 11 13

2 5 7 9 11 13

2 5 7 9 11 13

>> mean(y)
ans =

Columns 1 through 5

15.6667 19.1667 26.1667 25.6667 27.3333

Column 6

28.0000

>> cumprod(y)

ans =

Columns 1 through 4

3 8 12 15

33 72 252 345

99 936 3276 5865

1287 38376 173628 193545

55341 805896 5382468 6774075

1162161 18535608 145326636 209996325

Columns 5 through 6

17 13

340 221

6460 5083

239020 198237

8843740 9317139

300687160 270197031
>> cumsum(y)

ans =

3 8 12 15 17 13

14 17 33 38 37 30

17 30 46 55 56 53

30 71 99 88 93 92

73 92 130 123 130 139

94 115 157 154 164 168

2. a. >> fun = @(x) exp(-x.^2).*sin(x);

q = integral(fun,0,Inf)

q=

0.4244

b. >> syms x y z

>> int(int(int(x*y.^2*z.^5,x),y),z)

ans =

(x^2*y^3*z^6)/36

3. a. >> a=[1:10]/10
a=

Columns 1 through 4

0.1000 0.2000 0.3000 0.4000

Columns 5 through 8

0.5000 0.6000 0.7000 0.8000

Columns 9 through 10

0.9000 1.0000

b. >> c=1./[2:20]

c=

Columns 1 through 4

0.5000 0.3333 0.2500 0.2000

Columns 5 through 8

0.1667 0.1429 0.1250 0.1111

Columns 9 through 12

0.1000 0.0909 0.0833 0.0769


Columns 13 through 16

0.0714 0.0667 0.0625 0.0588

Columns 17 through 19

0.0556 0.0526 0.0500

c. >> c=1./[2:20:222]

c=

Columns 1 through 4

0.5000 0.0455 0.0238 0.0161

Columns 5 through 8

0.0122 0.0098 0.0082 0.0070

Columns 9 through 12

0.0062 0.0055 0.0050 0.0045

You might also like