Graf 1

You might also like

Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 17

graf 1

grafik 2

plot (x, w)

plot (w,x)

plot (x,y,'g:',x,z,'r-',x,y,'wo',x,z,'c+')

plot (x,y,x,z)

grid

To get started, select "MATLAB Help" from the Help menu.


>> A = [1 2 1 2; 3 5 4 6; 2 7 5 3]
A=
1
3
2

2
5
7

1
4
5

2
6
3

>> B = [1 3 4; 4 3 7; 2 3 9; 2 2 9]
B=
1
4
2
2

3
3
3
2

4
7
9
9

>> C = [ 2 1 2 2; 3 3 4 5; 6 7 8 9]
C=

2
3
6

1
3
7

2
4
8

2
5
9

>> A * B =
??? A * B =
|
Error: Expected a variable, function, or constant, found "end of line".
>> A * B
ans =
15
43
46

16 45
48 137
48 129

>> B * A
ans =
18
27
29
26

45
72
82
77

33
51
59
55

32
47
49
43

>> A .* B
??? Error using ==> .*
Matrix dimensions must agree.
>> A + C
ans =
3
6
8

3
8
14

3 4
8 11
13 12

>> A .+ C
??? A .+ C
|
Error: "identifier" expected, "+" found.
>> A ^ 2
??? Error using ==> ^
Matrix must be square.
>> A .^ 2
ans =
1
9
4

4
25
49

1 4
16 36
25 9

>> A - 2
ans =
-1
1
0

0
3
5

-1
2
3

0
4
1

>> 2 * A - 1
ans =
1
5
3

3
9
13

1 3
7 11
9 5

>> x=(0:0.1:1)*pi
x=
Columns 1 through 7
0

0.3142

0.6283

0.9425

1.2566

1.5708

1.8850

1.2566

1.5708

1.8850

Columns 8 through 11
2.1991

2.5133

2.8274

3.1416

>> x=linspace(0,pi,11)
x=
Columns 1 through 7
0

0.3142

0.6283

0.9425

Columns 8 through 11
2.1991

2.5133

2.8274

3.1416

>> a=1:5, b=1:2:9


a=
1

b=
1

>> c=[b a]
c=
1

>> d=[a(1:2:5) 1 0 1]
d=
1

>> p=[1 -12 0 25 116]


p=
1 -12

25 116

>> roots (p)


ans =
11.7473
2.7028
-1.2251 + 1.4672i
-1.2251 - 1.4672i
>> t=[1 5 6]
t=
1

>> roots (t)


ans =
-3.0000
-2.0000
>> a=[1 2 3 4]
a=
1

>> roots (a)


ans =
-1.6506
-0.1747 + 1.5469i
-0.1747 - 1.5469i
>> b=[1 4 9 16]
b=
1

>> roots (b)

16

ans =
-2.8204
-0.5898 + 2.3076i
-0.5898 - 2.3076i
>> c=[a * b]
??? Error using ==> *
Inner matrix dimensions must agree.
>> c= a * b
??? Error using ==> *
Inner matrix dimensions must agree.
>> c= a * b
??? Error using ==> *
Inner matrix dimensions must agree.
>> c=conv(a,b)
c=
1

20

50

75

84

64

>> polyval (t,5)


ans =
56
>> x=[0:30]
x=
Columns 1 through 12
0

17

18

19

20

29

30

10

11

Columns 13 through 24
12

13

14

15

16

Columns 25 through 31
24

25

26

27

28

>> x=[0:44/7:30]
x=
0

6.2857 12.5714 18.8571 25.1429

>> y= sin(x)
y=

21

22

23

0.0025

0.0051

0.0076

0.0101

0.6502

0.8670

>> plot (x,y)


>> plot (x,y)
>> polyval (c,5)
ans =
55484
>> x= linspace(0,44/7,30)
x=
Columns 1 through 7
0

0.2167

0.4335

1.0837

1.3005

Columns 8 through 14
1.5172

1.7340

1.9507

2.1675

2.3842

2.6010

2.8177

3.6847

3.9015

4.1182

4.3350

5.2020

5.4187

5.6355

5.8522

Columns 15 through 21
3.0345

3.2512

3.4680

Columns 22 through 28
4.5517

4.7685

4.9852

Columns 29 through 30
6.0690

6.2857

>> y= sin (x)


y=
Columns 1 through 7
0

0.2151

0.4200

0.6054

0.7624

0.8837

0.9637

Columns 8 through 14
0.9986

0.9867

0.9287

0.8272

0.6870

0.5147

0.3182

Columns 15 through 21
0.1069 -0.1094 -0.3206 -0.5168 -0.6888 -0.8286 -0.9296
Columns 22 through 28
-0.9871 -0.9984 -0.9630 -0.8825 -0.7607 -0.6034 -0.4178
Columns 29 through 30

-0.2126

0.0025

>> plot (x,y)


>> z= cos (x)
z=
Columns 1 through 7
1.0000

0.9766

0.9075

0.7959

0.6471

0.4680

0.2670

Columns 8 through 14
0.0535 -0.1625 -0.3709 -0.5619 -0.7267 -0.8574 -0.9480
Columns 15 through 21
-0.9943 -0.9940 -0.9472 -0.8561 -0.7249 -0.5598 -0.3685
Columns 22 through 28
-0.1600

0.0561

0.2695

0.4703

0.6490

0.7975

0.9086

Columns 29 through 30
0.9771

1.0000

>> plot (x, y, x, z)


>> plot (x, y, x, z);
>> plot (x,y,x,z)
>> w = [y ; z]
w=
Columns 1 through 7
0 0.2151 0.4200 0.6054 0.7624 0.8837 0.9637
1.0000 0.9766 0.9075 0.7959 0.6471 0.4680 0.2670
Columns 8 through 14
0.9986 0.9867 0.9287 0.8272 0.6870 0.5147 0.3182
0.0535 -0.1625 -0.3709 -0.5619 -0.7267 -0.8574 -0.9480
Columns 15 through 21
0.1069 -0.1094 -0.3206 -0.5168 -0.6888 -0.8286 -0.9296
-0.9943 -0.9940 -0.9472 -0.8561 -0.7249 -0.5598 -0.3685
Columns 22 through 28
-0.9871 -0.9984 -0.9630 -0.8825 -0.7607 -0.6034 -0.4178
-0.1600 0.0561 0.2695 0.4703 0.6490 0.7975 0.9086
Columns 29 through 30

-0.2126
0.9771

0.0025
1.0000

>> plot (x,w)


>> plot (x, w)
>> plot (w,x)
>> plot (x, y, 'g:', x, z, 'r-', x, y, 'w0', x, z, 'c+')
??? Error in color/linetype argument
>> plot (x, y, 'g:', x, z, 'r-', x, y, 'w0', x, z, 'c+');
??? Error in color/linetype argument
>> plot (x,y,'g:',x,z,'r-',x,y,'w0',x,z,'c+')
??? Error in color/linetype argument
>> plot (x, y,'g:', x, z,'r-', x, y,'w0', x, z,'c+')
??? Error in color/linetype argument
>> plot (x, y,'g:', x, z,'b-', x, y,'k0', x, z,'k+')
??? Error in color/linetype argument
>> plot (x,y,'g:',x,z,'r-',x,y,'wo',x,z,'c+')
>> x=linspace (0,2*pi,30)
x=
Columns 1 through 7
0

0.2167

0.4333

0.6500

0.8666

1.0833

1.3000

Columns 8 through 14
1.5166

1.7333

1.9500

2.1666

2.3833

2.5999

2.8166

3.6832

3.8999

4.1166

4.3332

5.1999

5.4165

5.6332

5.8499

0.7961

0.6474

0.4684

0.2675

Columns 15 through 21
3.0333

3.2499

3.4666

Columns 22 through 28
4.5499

4.7666

4.9832

Columns 29 through 30
6.0665

6.2832

>> y= sin (x); z=cos (x)


z=
Columns 1 through 7
1.0000

0.9766

0.9076

Columns 8 through 14

0.0541 -0.1618 -0.3701 -0.5612 -0.7260 -0.8569 -0.9477


Columns 15 through 21
-0.9941 -0.9941 -0.9477 -0.8569 -0.7260 -0.5612 -0.3701
Columns 22 through 28
-0.1618

0.0541

0.2675

0.4684

Columns 29 through 30
0.9766

1.0000

>> plot (x,y,x,z)


>> grid
>> xlabel ('variabel x bebas')
>> ylabel ('variabel y dan z tak-bebas')
>> title ('kurva sinus dan kosinus')

0.6474

0.7961

0.9076

You might also like