Anda di halaman 1dari 18

>> n = -5:5

n=

-5

-4

-3

-2

-1

>> x = 2*impseq(-2,-5,5)

x=

>> x1 = impseq(4,-5,5)

x1 =

-1

>> x2 = x-x1

x2 =

>> stem ([-5:5],x2)


>>

Coba 2
>> n = -3:3

n=

-3

-2

-1

>> x1 = 3*impseq(-1,-3,3)

x1 =

>> x2 = 2*impseq (3,-5,5)

x2 =

>> x3 = 3*impseq(2,-3,3)

x3 =

>> x = x1+x2-x3
Error using +
Matrix dimensions must agree.

>> x = x1 + x2 - x3
Error using +
Matrix dimensions must agree.

>> x2 = 2*impseq (3,-3,3)

x2 =

-3

>> x = x1+x2-x3

x=

>> stem ([-3:3],x)


>>
Coba 3
>> n = 0:20

n=

Columns 1 through 12

10

11

Columns 13 through 21

12

13

14

15

16

17

18

19

20

>> x1 = stepseq(0,0,20)

x1 =

Columns 1 through 12

Columns 13 through 21

>> x2 = stepseq(10,0,20)

x2 =

Columns 1 through 12

Columns 13 through 21

>> x = x1 - x2

x=

Columns 1 through 11

Columns 12 through 21

>> stem ([0:20],x)


Coba 4
>> n = 0:20

n=

Columns 1 through 12

10

11

Columns 13 through 21

12

13

14

15

16

17

18

19

20

>> x1 = 2*stepseq(0,0,20)

x1 =

Columns 1 through 12

Columns 13 through 21

>> x2 = 3*stepseq(5,0,20)

x2 =

Columns 1 through 12

Columns 13 through 21

>> x3 = stepseq
Error using stepseq (line 11)
Not enough input arguments.

>> x3 = stepseq(10,0,20)

x3 =

Columns 1 through 11

Columns 12 through 21

>> x = x1+x2-x3

x=

Columns 1 through 11

Columns 12 through 21

>> stem (n,x)

Cobaaaa putar

>> x = rand (1,7)

x=

0.5469

0.9575

0.9649

0.1576

0.9706

0.9572

0.4854

0.9706

0.1576

0.9649

0.9575

0.5469

1.9355

0.3152

1.9355

1.9147

1.0323

>> figure (1)


>> stem (x)
>> x1 = fliplr (x)

x1 =

0.4854

0.9572

>> figure (2)


>> stem (x1)
>> even = x + x1

even =

1.0323

1.9147

>> figure (3)


>> stem(even)
>> odd = x - x1

odd =

0.0615

0.0003 -0.0057

>> figure (4)


>> stem (odd)

0.0057 -0.0003 -0.0615

>> sinyalasli = 0.5 * (even+odd)

sinyalasli =

0.5469

0.9575

0.9649

0.1576

0.9706

0.9572

11

>> figure (5)


>> stem(sinyalasli)
>> figure (1)
>> stem (x)
>> figure (5)
>> stem(sinyalasli)

Contoh soal 2.1


>> n = 0:20

n=

Columns 1 through 12

Columns 13 through 21

12

13

14

15

16

>> x1 = stepseq(0,0,20)

x1 =

Columns 1 through 12

17

18

19

20

10

0.4854

Columns 13 through 21

>> x2 = stepseq(10,0,20)

x2 =

Columns 1 through 12

Columns 13 through 21

>> x3 = n*(x1-x2)
Error using *
Inner matrix dimensions must agree.

>> x3 = n[(x1-x2)]
x3 = n[(x1-x2)]
|
Error: Unbalanced or unexpected parenthesis or bracket.

>> x3 = n.*[(x1-x2)]

x3 =

Columns 1 through 11

Columns 12 through 21

>> x4 = 10*exp(-0.3*(n-10))

x4 =

Columns 1 through 7

200.8554 148.7973 110.2318 81.6617 60.4965 44.8169 33.2012

Columns 8 through 14

24.5960 18.2212 13.4986 10.0000

7.4082

5.4881

4.0657

Columns 15 through 21

3.0119

2.2313

1.6530

1.2246

0.9072

>> x5 = stepseq(10,0,20)

x5 =

Columns 1 through 11

0.6721

0.4979

Columns 12 through 21

>> x6 = stepseq(20,0,20)

x6 =

Columns 1 through 11

Columns 12 through 21

>> x7 = x5-x6

x7 =

Columns 1 through 11

Columns 12 through 21

>> x = x3+x4*x7
Error using *
Inner matrix dimensions must agree.

>> x = x3+x4*(x7)
Error using *
Inner matrix dimensions must agree.

>> x = x3+x4.*(x7)

x=

Columns 1 through 7

1.0000

2.0000

3.0000

4.0000

5.0000

6.0000

Columns 8 through 14

7.0000

8.0000

9.0000 10.0000

7.4082

5.4881

4.0657

Columns 15 through 21

3.0119

2.2313

1.6530

1.2246

0.9072

>> stem (x)

Example 2.1 c
>> n = 0:50

n=

Columns 1 through 11

Columns 12 through 22

10

0.6721

11

12

13

14

15

16

17

18

19

20

21

27

28

29

30

31

32

38

39

40

41

42

43

49

50

Columns 23 through 33

22

23

24

25

26

Columns 34 through 44

33

34

35

36

37

Columns 45 through 51

44

45

46

47

48

>> x1 = cos*(0.04*pi.*n)
Error using cos
Not enough input arguments.

>> x1 = cos(0.04*pi.*n)

x1 =

Columns 1 through 6

1.0000

0.9921

0.9686

0.9298

0.8763

0.8090

0.4258

0.3090

0.1874

Columns 7 through 12

0.7290

0.6374

0.5358

Columns 13 through 18

0.0628 -0.0628 -0.1874 -0.3090 -0.4258 -0.5358

Columns 19 through 24

-0.6374 -0.7290 -0.8090 -0.8763 -0.9298 -0.9686

Columns 25 through 30

-0.9921 -1.0000 -0.9921 -0.9686 -0.9298 -0.8763

Columns 31 through 36

-0.8090 -0.7290 -0.6374 -0.5358 -0.4258 -0.3090

Columns 37 through 42

-0.1874 -0.0628

0.0628

0.1874

0.3090

0.4258

0.8090

0.8763

0.9298

Columns 43 through 48

0.5358

0.6374

0.7290

Columns 49 through 51

0.9686

0.9921

1.0000

>> x2 = 0.2*rand(0,50)

x2 =

Empty matrix: 0-by-50

>> x2 = 0.2*rand(0:50)

x2 =

Empty array: 0-by-1-by-2-by-3-by-4-by-5-by-6-by-7-by-8-by-9-by-10-by-11-by12-by-13-by-14-by-15-by-16-by-17-by-18-by-19-by-20-by-21-by-22-by-23-by-24by-25-by-26-by-27-by-28-by-29-by-30-by-31-by-32-by-33-by-34-by-35-by-36-by37-by-38-by-39-by-40-by-41-by-42-by-43-by-44-by-45-by-46-by-47-by-48-by-49by-50

>> x2 = 0.2*randn(0:50)

x2 =

Empty array: 0-by-1-by-2-by-3-by-4-by-5-by-6-by-7-by-8-by-9-by-10-by-11-by12-by-13-by-14-by-15-by-16-by-17-by-18-by-19-by-20-by-21-by-22-by-23-by-24by-25-by-26-by-27-by-28-by-29-by-30-by-31-by-32-by-33-by-34-by-35-by-36-by37-by-38-by-39-by-40-by-41-by-42-by-43-by-44-by-45-by-46-by-47-by-48-by-49by-50

>> x2 = 0.2*randn(n)

x2 =

Empty array: 0-by-1-by-2-by-3-by-4-by-5-by-6-by-7-by-8-by-9-by-10-by-11-by12-by-13-by-14-by-15-by-16-by-17-by-18-by-19-by-20-by-21-by-22-by-23-by-24by-25-by-26-by-27-by-28-by-29-by-30-by-31-by-32-by-33-by-34-by-35-by-36-by37-by-38-by-39-by-40-by-41-by-42-by-43-by-44-by-45-by-46-by-47-by-48-by-49by-50

>> x2 = 0.2*randn(size(n))

x2 =

Columns 1 through 6

0.1429 -0.0410 -0.0248

0.2979

0.2818

0.2834

0.3260

0.0978

0.2069

Columns 7 through 12

0.1343 -0.2415

0.1434

Columns 13 through 18

0.1454 -0.0607

0.0588 -0.1575

0.1777 -0.2294

Columns 19 through 24

-0.2138 -0.1619 -0.5889

0.2877

0.0650 -0.1510

Columns 25 through 30

0.2741 -0.3423 -0.0204 -0.0483

0.0638

0.0626

0.2187

0.2219

0.0155 -0.2428 -0.2227 -0.0014

0.3065

Columns 31 through 36

-0.1730 -0.0060 -0.0330

0.1255

Columns 37 through 42

-0.1727

Columns 43 through 48

-0.1539

0.0743 -0.0451

Columns 49 through 51

0.2235 -0.2178

0.0065

0.1105

0.2201

0.3088

>> x = x1+x2

x=

Columns 1 through 6

1.1429

0.9511

0.9438

1.2277

1.1581

1.0925

0.7518

0.4068

0.3943

Columns 7 through 12

0.8633

0.3959

0.6793

Columns 13 through 18

0.2082 -0.1235 -0.1286 -0.4665 -0.2481 -0.7652

Columns 19 through 24

-0.8512 -0.8909 -1.3979 -0.5886 -0.8647 -1.1196

Columns 25 through 30

-0.7181 -1.3423 -1.0126 -1.0169 -0.8659 -0.8137

Columns 31 through 36

-0.9820 -0.7350 -0.6704 -0.4103 -0.2071 -0.0872

Columns 37 through 42

-0.3601 -0.0473 -0.1800 -0.0353

0.3076

0.7323

0.6585

0.9363

Columns 43 through 48

0.3819

0.7117

0.6839

Columns 49 through 51

1.0791

1.2122

>> stem(x)
>>
Example 2.1d

1.3088

1.0325

Anda mungkin juga menyukai