You are on page 1of 4

>> A = [1 2 3; 8 6 4; 3 6 9]

A =

1 2 3
8 6 4
3 6 9

>> B = [1 2 3 4 5; 2 5 8 9]
Dimensions of matrices being concatenated are not
consistent.

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

B =

1 2 3 4 5
2 4 6 8 7

>> A(1,3) + A(2,1) + A(3,2)

ans =

17

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

C =

1 2
3 4
5 6
7 8
9 10

>> B(1,1) + B(1,2) + B(2,4) + B(2,5)

ans =

18

>> A(1,3) * A(2,1) * A(3,2)

ans =

144

>> A(1;2, 2;3)


A(1;2, 2;3)

Error: Unbalanced or unexpected parenthesis or
bracket.

>> A(1:2,1:3)

ans =

1 2 3
8 6 4
>> C(1:2;1:2)
C(1:2;1:2)

Error: Unbalanced or unexpected parenthesis or
bracket.

>> C(1:2,1:2)

ans =

1 2
3 4

>>
>> A(:,23)
Index exceeds matrix dimensions.

>> A(:,3)

ans =

3
4
9

>> A(3,:)

ans =

3 6 9

>> V = (100 :-5:10)

V =

Columns 1 through 8

100 95 90 85 80 75 70 65

Columns 9 through 16

60 55 50 45 40 35 30 25

Columns 17 through 19

20 15 10

>> X=(0:2:10)

X =

0 2 4 6 8 10

>> X(0:10)
Subscript indices must either be real positive
integers or logicals.

>> x(0:10)
Undefined function or variable 'x'.

Did you mean:


>> X=(0:10)

X =

Columns 1 through 8

0 1 2 3 4 5 6 7

Columns 9 through 11

8 9 10

>> F=(10:0)

F =

Empty matrix: 1-by-0

>> F(0:5:27)
Subscript indices must either be real positive
integers or logicals.

>> D=(0:2:13)

D =

0 2 4 6 8 10 12

>> xx=zeros(3,4)

xx =

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

>> yy=ones(2,2)

yy =

1 1
1 1

>> ss=ones(3,3)*8

ss =

8 8 8
8 8 8
8 8 8

>> cc=rand(4,4)

cc =

0.8147 0.6324 0.9575 0.9572


0.9058 0.0975 0.9649 0.4854
0.1270 0.2785 0.1576 0.8003
0.9134 0.5469 0.9706 0.1419

>> dd=randn(2,5)

dd =

-0.1241 1.4090 0.6715 0.7172 0.4889


1.4897 1.4172 -1.2075 1.6302 1.0347

>> oo=rand(2,2)*1000

oo =

743.1325 655.4779
392.2270 171.1867

>> clc

You might also like