Topik 1
Topik 1
9*pi pi]
x =
Columns 1 through 4
Columns 5 through 8
Columns 9 through 11
y=sin(x)
y =
x(3)
ans =
0.6283
x(5)
ans =
1.2566
x(1:5)
ans =
y(3:-1:1)
ans =
0.5878 0.3090 0
x(2:2:7)
ans =
y([8 2 9 1])
ans =
x =
x=linspace(0,pi,11)
x =
x=linspace(0,10,2)
x =
0 10
a-2
{#??? Undefined function or variable 'a'.
}#
logspace(0,2,11)
ans =
a=1:5, b=1:2:9
a =
1 2 3 4 5
b =
1 3 5 7 9
c=[a b]
c =
1 2 3 4 5 1 3 5 7 9
cc=[a;b]
cc =
1 2 3 4 5
1 3 5 7 9
d=[a(1:2:5) 1 0 1]
d =
1 3 5 1 0 1
a-2
ans =
-1 0 1 2 3
2*a-2
ans =
0 2 4 6 8
a./b
ans =
a+b
ans =
2 5 8 11 14
a.*b
ans =
1 6 15 28 45
ans-b
ans =
0 3 10 21 36
a*b
{#??? Error using ==> mtimes
Inner matrix dimensions must agree.
}#
a/b
ans =
0.5758
a.^2
ans =
1 4 9 16 25
b.^a
ans =
ans =
2 8 18 32 50
b.^(a-3)
ans =
c=[1;2;3;4;5]
c =
1
2
3
4
5
c=a.'
c =
1
2
3
4
5
a=1:5
a =
1 2 3 4 5
d=a+I*a
{#??? Undefined function or variable 'I'.
}#
b=a'
b =
1
2
3
4
5
d=a+i*a
d =
e=d'
e =
1.0000 - 1.0000i
2.0000 - 2.0000i
3.0000 - 3.0000i
4.0000 - 4.0000i
5.0000 - 5.0000i
c=d'
c =
1.0000 - 1.0000i
2.0000 - 2.0000i
3.0000 - 3.0000i
4.0000 - 4.0000i
5.0000 - 5.0000i
c=b'
c =
1 2 3 4 5
f=d.'
f =
1.0000 + 1.0000i
2.0000 + 2.0000i
3.0000 + 3.0000i
4.0000 + 4.0000i
5.0000 + 5.0000i
g=[1234;5678]
g =
1234
5678
g=[1 2 3 4
5 6 7 8
9 10 11 12]
g =
1 2 3 4
5 6 7 8
9 10 11 12
h=[1,2,3;4,5,6;7,8,9]
h =
1 2 3
4 5 6
7 8 9
k=[1,2,3;4,5,6,7]
{#??? Error using ==> vertcat
CAT arguments dimensions are not consistent.
}#
k=[1,2,3,4;5,6,7,8]
k =
1 2 3 4
5 6 7 8
k=[1,2,3;4,5,6]
k =
1 2 3
4 5 6