1、Matlab向量的生成方法
(1)直接输入法
(2)冒号生成法
(3)线性等分法
2、直接输入法
>> a=[1,2,3,4;5,6,7,8;9,10,11,12]
a =
1 2 3 4
5 6 7 8
9 10 11 12
3、冒号生成法
>> b=1:2:100
b =
Columns 1 through 17
1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33
Columns 18 through 34
35 37 39 41 43 45 47 49 51 53 55 57 59 61 63 65 67
Columns 35 through 50
69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99
>> c=100:-2:1
c =
Columns 1 through 17
100 98 96 94 92 90 88 86 84 82 80 78 76 74 72 70 68
Columns 18 through 34
66 64 62 60 58 56 54 52 50 48 46 44 42 40 38 36 34
Columns 35 through 50
32 30 28 26 24 22 20 18 16 14 12 10 8 6 4 2
4、线性等分法
>> d=linspace(1,100,20)
d =
Columns 1 through 10
1.0000 6.2105 11.4211 16.6316 21.8421 27.0526 32.2632 37.4737 42.6842 47.8947
Columns 11 through 20
53.1053 58.3158 63.5263 68.7368 73.9474 79.1579 84.3684 89.5789 94.7895 100.0000