Professional Documents
Culture Documents
Matlab
Building matrices
Command Meaning
>> A = [2, 4; 6, 8]
A=
2 4
6 8
The commas can be replaced by spaces.
>> A = [2 4; 6 8]
A=
2 4
6 8
>> C, D
C=
2 4 1 3 6 8 5 7
D=
24681357
>> 1:1:5
ans =
1 23 45
In this example we have created a sequence of numbers starting from 1 and
ending at 5 with a step size of 1.
>> F = [1:1:5;11:2:20]
F=
1 2 3 4 5 11 13 15 17 19
>> randn(3,3)